diff options
author | Corentin Noël <corentin.noel@collabora.com> | 2022-01-14 18:00:54 +0100 |
---|---|---|
committer | Corentin Noël <tintou@noel.tf> | 2022-05-09 09:51:51 +0000 |
commit | 1fc96325357b225f517cc35d874bbb9b2697281b (patch) | |
tree | 308bcf91e5af0edb8a60de2b1aa335d6bac52681 /framework | |
parent | cc69093445150c3a283b42b3e4cd9caa8da10a0b (diff) |
Make it work with the latest pytest version
Fix all deprecation warnings. Remove testing for python 3.6.
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/626>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/backends/json.py | 2 | ||||
-rw-r--r-- | framework/core.py | 10 | ||||
-rw-r--r-- | framework/replay/backends/gfxreconstruct.py | 4 | ||||
-rw-r--r-- | framework/test/opencv.py | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/framework/backends/json.py b/framework/backends/json.py index 375d4075e..a0126f652 100644 --- a/framework/backends/json.py +++ b/framework/backends/json.py @@ -176,7 +176,7 @@ class JSONBackend(FileBackend): encoder = functools.partial(json.JSONEncoder, default=piglit_encoder) with self._write_final(os.path.join(self._dest, 'results.json')) as f: - with jsonstreams.Stream(jsonstreams.Type.object, fd=f, indent=4, + with jsonstreams.Stream(jsonstreams.Type.OBJECT, fd=f, indent=4, encoder=encoder, pretty=True) as s: s.write('__type__', 'TestrunResult') with open(os.path.join(self._dest, 'metadata.json'), diff --git a/framework/core.py b/framework/core.py index 9fb60a2bb..2d98df578 100644 --- a/framework/core.py +++ b/framework/core.py @@ -51,9 +51,9 @@ class PiglitConfig(configparser.ConfigParser): super().__init__(*args, **kwargs) self.filename = None - def readfp(self, fp, filename=None): - super().readfp(fp, filename) - self.filename = os.path.abspath(filename or fp.name) + def read_file(self, f, source=None): + super().read_file(f, source) + self.filename = os.path.abspath(source or f.name) def safe_get(self, section, option, fallback=None, **kwargs): """A version of self.get that doesn't raise NoSectionError or @@ -94,7 +94,7 @@ PIGLIT_CONFIG = PiglitConfig(allow_no_value=True) def get_config(arg=None): if arg: - PIGLIT_CONFIG.readfp(arg) + PIGLIT_CONFIG.read_file(open(arg)) else: # Load the piglit.conf. First try looking in the current directory, # then trying the XDG_CONFIG_HOME, then $HOME/.config/, finally try the @@ -105,7 +105,7 @@ def get_config(arg=None): os.path.join(os.path.dirname(__file__), '..')]: try: with open(os.path.join(d, 'piglit.conf'), 'r') as f: - PIGLIT_CONFIG.readfp(f) + PIGLIT_CONFIG.read_file(f) break except IOError: pass diff --git a/framework/replay/backends/gfxreconstruct.py b/framework/replay/backends/gfxreconstruct.py index 8186e8130..fe735f09e 100644 --- a/framework/replay/backends/gfxreconstruct.py +++ b/framework/replay/backends/gfxreconstruct.py @@ -48,9 +48,9 @@ __all__ = [ _MIN_VERSION = version.Version('0.9.4') -_VERSION_RE = re.compile('\s*GFXReconstruct Version\s*([0-9]\.[0-9]\.[0-9])') +_VERSION_RE = re.compile(r'\s*GFXReconstruct Version\s*([0-9]\.[0-9]\.[0-9])') -_TOTAL_FRAMES_RE = re.compile('\s*Total frames:\s*([0-9]*)') +_TOTAL_FRAMES_RE = re.compile(r'\s*Total frames:\s*([0-9]*)') class GFXReconstructBackend(DumpBackend): """ replayer's GFXReconstruct dump backend diff --git a/framework/test/opencv.py b/framework/test/opencv.py index c107d2495..3d824b808 100644 --- a/framework/test/opencv.py +++ b/framework/test/opencv.py @@ -65,7 +65,7 @@ def add_opencv_tests(profile): full_test_name = '' for line in test_list: #Test groups names start at the beginning of the line and end with '.' - m = re.match('([^.]+\.)$', line) + m = re.match(r'([^.]+\.)$', line) if m: group_name = m.group(1) group_desc = group_name[:-1] |