diff --git a/tests/test_config_deprecated.py b/tests/test_config_deprecated.py index dc5d399..90eb28b 100644 --- a/tests/test_config_deprecated.py +++ b/tests/test_config_deprecated.py @@ -34,7 +34,7 @@ def setUp(self): foo: [1, null] """ self.handle, self.yamlfile = tempfile.mkstemp(suffix=".yaml") - with Path.open(self.yamlfile, "w") as f: + with Path(self.yamlfile).open("w") as f: f.write(template) self.expected_dict = { @@ -51,21 +51,21 @@ def setUp(self): def tearDown(self): os.close(self.handle) - Path.unlink(self.yamlfile) + Path(self.yamlfile).unlink() def test_load_yaml_dict_object(self): - with Path.open(self.yamlfile) as f: + with Path(self.yamlfile).open() as f: y = yaml.load(f.read()) qc = QcConfig(y) assert qc.config == self.expected_dict def test_load_yaml_str(self): - with Path.open(self.yamlfile) as f: + with Path(self.yamlfile).open() as f: qc = QcConfig(f.read()) assert qc.config == self.expected_dict def test_load_json_str(self): - with Path.open(self.yamlfile) as f: + with Path(self.yamlfile).open() as f: js = json.dumps(yaml.load(f.read())) qc = QcConfig(js) assert qc.config == self.expected_dict @@ -81,7 +81,7 @@ def test_load_yaml_path_object(self): def test_load_json_stringio(self): st = io.StringIO() qc = QcConfig(self.yamlfile) - with Path.open(self.yamlfile) as f: + with Path(self.yamlfile).open() as f: js = json.dumps(yaml.load(f.read())) st.write(js) qc = QcConfig(st) @@ -90,7 +90,7 @@ def test_load_json_stringio(self): def test_load_yaml_stringio(self): st = io.StringIO() - with Path.open(self.yamlfile) as f: + with Path(self.yamlfile).open() as f: st.write(f.read()) qc = QcConfig(st) st.close() @@ -294,12 +294,13 @@ def setUp(self): period: month """ self.handle, self.yamlfile = tempfile.mkstemp(suffix=".yaml") - with Path.open(self.yamlfile, "w") as f: + p = Path(self.yamlfile) + with p.open("w") as f: f.write(template) def tearDown(self): os.close(self.handle) - Path.unlink(self.yamlfile) + Path(self.yamlfile).unlink() def test_climatology_config_yaml_conversion(self): qc = QcConfig(self.yamlfile) diff --git a/tests/test_qartod.py b/tests/test_qartod.py index fc6699a..77888ac 100644 --- a/tests/test_qartod.py +++ b/tests/test_qartod.py @@ -2051,7 +2051,7 @@ def test_density_inversion_input(self): depth = [1, 2, 3] match = ( - "ufunc 'less' did not contain a loop with signature matching types" + "'less'|<" ) # Wrong type suspect_threshold with pytest.raises(TypeError, match=match): diff --git a/tests/test_utils.py b/tests/test_utils.py index af301be..8109e3d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -62,7 +62,7 @@ def setUp(self): def tearDown(self): os.close(self.fh) - Path.unlink(self.fp) + Path(self.fp).unlink() def test_load_from_xarray_file(self): c = utils.load_config_as_dict(self.fp)