From 022cc4d1857271da82d835c87f9d1b98e2c2b055 Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Wed, 7 Dec 2022 11:55:29 +0100 Subject: [PATCH] Use pytest directly, as going via py does no longer work Starting with pytest 7.2.0(?) py.test.raises only works if py is also installed. Given https://github.com/pytest-dev/py/issues/288 it is probably easiest to just use pytest directly if possible --- ilcsoft/test_version.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ilcsoft/test_version.py b/ilcsoft/test_version.py index 09d7b2de..3f9a70d4 100644 --- a/ilcsoft/test_version.py +++ b/ilcsoft/test_version.py @@ -3,30 +3,30 @@ ################################################ from .version import Version -import py +import pytest def test_sanity(): - py.test.raises(TypeError, Version ) - py.test.raises(ValueError, Version, 0) - py.test.raises(ValueError, Version, []) - py.test.raises(ValueError, Version, '') - py.test.raises(ValueError, Version, '1') - py.test.raises(ValueError, Version, '1.') - py.test.raises(ValueError, Version, 'a.b') - py.test.raises(ValueError, Version, 'blah') + pytest.raises(TypeError, Version ) + pytest.raises(ValueError, Version, 0) + pytest.raises(ValueError, Version, []) + pytest.raises(ValueError, Version, '') + pytest.raises(ValueError, Version, '1') + pytest.raises(ValueError, Version, '1.') + pytest.raises(ValueError, Version, 'a.b') + pytest.raises(ValueError, Version, 'blah') def test_general(): MIN_ELEM = Version._min_elements # versions must have at least one element > 0 - py.test.raises(ValueError, Version, MIN_ELEM * (0,) ) + pytest.raises(ValueError, Version, MIN_ELEM * (0,) ) # elements must be integers or convertible to int - py.test.raises(ValueError, Version, (MIN_ELEM * [1]) + ['a'] ) + pytest.raises(ValueError, Version, (MIN_ELEM * [1]) + ['a'] ) # elements must be >= 0 - py.test.raises(ValueError, Version, (MIN_ELEM * [1]) + [-1] ) + pytest.raises(ValueError, Version, (MIN_ELEM * [1]) + [-1] ) # cutting off / filling missing elements MAX_ELEM = 4