-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
The plugin seems to have a manual check for Python versions that it supports. 3.9 is to be released soon. Nose has problems related to importing ABC from collections directly nose-devs/nose#1099 . This change was postponed to 3.10 but might cause more people to migrate to pytest.
Also note that lib2to3 is deprecated since Python 3.10.
nose2pytest/script.py:21
/root/checked_repos/nose2pytest/nose2pytest/script.py:21: PendingDeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
from lib2to3 import refactor, fixer_base, pygram, pytree, pgen2
python -m pytest -p no:relaxed
========================================================================= test session starts ==========================================================================
platform linux -- Python 3.9.0b5, pytest-6.0.2, py-1.9.0, pluggy-0.12.0
rootdir: /root/checked_repos/nose2pytest
plugins: hypothesis-4.43.1, xdist-1.28.0, forked-1.3.0, cov-2.8.1
collected 0 items / 1 error
================================================================================ ERRORS ================================================================================
________________________________________________________________ ERROR collecting tests/test_script.py _________________________________________________________________
tests/test_script.py:8: in <module>
from nose2pytest.script import NoseConversionRefactoringTool
nose2pytest/script.py:115: in <module>
raise RuntimeError('nose2pytest must be run using Python in [3.4, 3.5, 3.6, 3.7, 3.8]')
E RuntimeError: nose2pytest must be run using Python in [3.4, 3.5, 3.6, 3.7, 3.8]
=========================================================================== warnings summary ===========================================================================
nose2pytest/script.py:21
/root/checked_repos/nose2pytest/nose2pytest/script.py:21: PendingDeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
from lib2to3 import refactor, fixer_base, pygram, pytree, pgen2
-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================================================================= short test summary info ========================================================================
ERROR tests/test_script.py - RuntimeError: nose2pytest must be run using Python in [3.4, 3.5, 3.6, 3.7, 3.8]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================== 1 warning, 1 error in 0.40s ======================================================================
Enabling 3.9 in the conditional gives me below errors :
python -m pytest -p no:relaxed
========================================================================= test session starts ==========================================================================
platform linux -- Python 3.9.0b5, pytest-6.0.2, py-1.9.0, pluggy-0.12.0
rootdir: /root/checked_repos/nose2pytest
plugins: hypothesis-4.43.1, xdist-1.28.0, forked-1.3.0, cov-2.8.1
collected 16 items
tests/test_script.py ......F...F..FFF [100%]
=============================================================================== FAILURES ===============================================================================
______________________________________________________________________ Test2Args.test_add_parens _______________________________________________________________________
self = <test_script.Test2Args object at 0x7fe587817790>
def test_add_parens(self):
check_transformation('assert_in(a == b, d)',
'assert (a == b) in d')
check_transformation('assert_in(a != b, d)',
'assert (a != b) in d')
check_transformation('assert_in(b <= c, d)',
'assert (b <= c) in d')
check_transformation('assert_in(c >= d, d)',
'assert (c >= d) in d')
check_transformation('assert_in(d < e, d)',
'assert (d < e) in d')
check_transformation('assert_in(d > e, d)',
'assert (d > e) in d')
check_transformation('assert_equal(a in b, c)',
'assert (a in b) == c')
check_transformation('assert_equal(a not in b, c)',
'assert (a not in b) == c')
check_transformation('assert_equal(a is b, c)',
'assert (a is b) == c')
check_transformation('assert_equal(a is not b, c)',
'assert (a is not b) == c')
> check_transformation('assert_equal(not a, c)',
'assert (not a) == c')
tests/test_script.py:148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = 'assert_equal(not a, c)', expect = 'assert (not a) == c'
def check_transformation(input, expect):
result = refac.refactor_string(dedent(input + '\n'), 'script')
> assert dedent(expect + '\n') == str(result)
E AssertionError: assert 'assert (not a) == c\n' == 'assert not a == c\n'
E - assert not a == c
E + assert (not a) == c
E ? + +
tests/test_script.py:38: AssertionError
______________________________________________________________________ Test3Args.test_add_parens _______________________________________________________________________
self = <test_script.Test3Args object at 0x7fe5877ac1c0>
def test_add_parens(self):
check_transformation('assert_almost_equal(a + b, c, delta=d>e)', 'assert abs((a + b) - c) <= (d>e)')
check_transformation('assert_almost_equal(a | b, c ^ d, delta=0.1)', 'assert abs((a | b) - (c ^ d)) <= 0.1')
check_transformation('assert_almost_equal(a & b, c << d, delta=0.1)', 'assert abs((a & b) - (c << d)) <= 0.1')
> check_transformation('assert_almost_equal(a or b, c >> d, delta=0.1)', 'assert abs((a or b) - (c >> d)) <= 0.1')
tests/test_script.py:288:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = 'assert_almost_equal(a or b, c >> d, delta=0.1)', expect = 'assert abs((a or b) - (c >> d)) <= 0.1'
def check_transformation(input, expect):
result = refac.refactor_string(dedent(input + '\n'), 'script')
> assert dedent(expect + '\n') == str(result)
E AssertionError: assert 'assert abs((... d)) <= 0.1\n' == 'assert abs(a... d)) <= 0.1\n'
E - assert abs(a or b - (c >> d)) <= 0.1
E + assert abs((a or b) - (c >> d)) <= 0.1
E ? + +
tests/test_script.py:38: AssertionError
_____________________________________________________________________ TestAssertTools.test_almost ______________________________________________________________________
self = <test_script.TestAssertTools object at 0x7fe5877cc280>
def test_almost(self):
> from pytest import assert_almost_equal, assert_not_almost_equal
E ImportError: cannot import name 'assert_almost_equal' from 'pytest' (/root/py39-venv/lib/python3.9/site-packages/pytest/__init__.py)
tests/test_script.py:322: ImportError
________________________________________________________________ TestAssertTools.test_dict_keys_subset _________________________________________________________________
self = <test_script.TestAssertTools object at 0x7fe5877cc460>
def test_dict_keys_subset(self):
dict1 = dict(a=1, b=2, c=3)
# check keys are subset:
dict2 = dict1.copy()
> pytest.assert_dict_contains_subset(dict1, dict2)
E AttributeError: module 'pytest' has no attribute 'assert_dict_contains_subset'
tests/test_script.py:336: AttributeError
_______________________________________________________________ TestAssertTools.test_dict_values_subset ________________________________________________________________
self = <test_script.TestAssertTools object at 0x7fe587748280>
def test_dict_values_subset(self):
dict1 = dict(a=1, b=2, c=3)
# check keys are subset:
dict2 = dict1.copy()
dict2['d'] = 4
dict2['a'] = 4
> pytest.raises(AssertionError, pytest.assert_dict_contains_subset, dict1, dict2)
E AttributeError: module 'pytest' has no attribute 'assert_dict_contains_subset'
tests/test_script.py:352: AttributeError
=========================================================================== warnings summary ===========================================================================
nose2pytest/script.py:21
/root/checked_repos/nose2pytest/nose2pytest/script.py:21: PendingDeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
from lib2to3 import refactor, fixer_base, pygram, pytree, pgen2
tests/test_script.py::Test1Arg::test_params
/root/py39-venv/lib/python3.9/site-packages/nose/importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
from imp import find_module, load_module, acquire_lock, release_lock
tests/test_script.py::Test1Arg::test_same_results
tests/test_script.py::Test2Args::test_same_results
tests/test_script.py::Test2Args::test_same_results
<string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
tests/test_script.py::Test1Arg::test_same_results
tests/test_script.py::Test2Args::test_same_results
tests/test_script.py::Test2Args::test_same_results
<string>:1: SyntaxWarning: "is not" with a literal. Did you mean "!="?
tests/test_script.py::Test2Args::test_same_results
tests/test_script.py::Test2Args::test_same_results
<string>:1: DeprecationWarning: Please use assertEqual instead.
tests/test_script.py::Test2Args::test_same_results
tests/test_script.py::Test2Args::test_same_results
<string>:1: DeprecationWarning: Please use assertNotEqual instead.
tests/test_script.py::Test3Args::test_almost_equal
tests/test_script.py::Test3Args::test_almost_equal
tests/test_script.py::Test3Args::test_almost_equal
tests/test_script.py::Test3Args::test_almost_equal
<string>:1: DeprecationWarning: Please use assertAlmostEqual instead.
tests/test_script.py::Test3Args::test_almost_equal
tests/test_script.py::Test3Args::test_almost_equal
tests/test_script.py::Test3Args::test_almost_equal
tests/test_script.py::Test3Args::test_almost_equal
<string>:1: DeprecationWarning: Please use assertNotAlmostEqual instead.
-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================================================================= short test summary info ========================================================================
FAILED tests/test_script.py::Test2Args::test_add_parens - AssertionError: assert 'assert (not a) == c\n' == 'assert not a == c\n'
FAILED tests/test_script.py::Test3Args::test_add_parens - AssertionError: assert 'assert abs((... d)) <= 0.1\n' == 'assert abs(a... d)) <= 0.1\n'
FAILED tests/test_script.py::TestAssertTools::test_almost - ImportError: cannot import name 'assert_almost_equal' from 'pytest' (/root/py39-venv/lib/python3.9/site-p...
FAILED tests/test_script.py::TestAssertTools::test_dict_keys_subset - AttributeError: module 'pytest' has no attribute 'assert_dict_contains_subset'
FAILED tests/test_script.py::TestAssertTools::test_dict_values_subset - AttributeError: module 'pytest' has no attribute 'assert_dict_contains_subset'
============================================================== 5 failed, 11 passed, 20 warnings in 0.62s ===============================================================
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels