diff --git a/test_requirements.txt b/test_requirements.txt index 245050f231..9099e0a4e9 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,4 +1,4 @@ -pytest +pytest>=5,<6 pytest-cov pytest-asyncio aiohttp diff --git a/tests/io/test_empad.py b/tests/io/test_empad.py index e0c2667381..2cf8a7a323 100644 --- a/tests/io/test_empad.py +++ b/tests/io/test_empad.py @@ -141,9 +141,10 @@ def test_invalid_size(): scan_size=(4, 5), ) ds = ds.initialize() - with pytest.raises(DataSetException) as e: + with pytest.raises(DataSetException) as einfo: ds.check_valid() - assert "invalid filesize" in str(e) + + assert einfo.match("invalid filesize") def test_nonexistent(): @@ -151,9 +152,9 @@ def test_nonexistent(): path="/does/not/exist.raw", scan_size=(4, 4), ) - with pytest.raises(DataSetException) as e: + with pytest.raises(DataSetException) as einfo: ds = ds.initialize() - assert "No such file or directory" in str(e) + assert einfo.match("No such file or directory") def test_detect_fail(): diff --git a/tests/test_analysis_base.py b/tests/test_analysis_base.py index 30114dc769..cf01448e6d 100644 --- a/tests/test_analysis_base.py +++ b/tests/test_analysis_base.py @@ -14,10 +14,10 @@ def test_result_set(): results = AnalysisResultSet([result]) - with pytest.raises(AttributeError) as e: + with pytest.raises(AttributeError) as einfo: results.foo - assert "not found" in str(e) - assert "have: test" in str(e) + assert einfo.match("not found") + assert einfo.match("have: test") assert results.test == result assert len(results) == 1