Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test failures with pytest 8.2: AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'? #363

Closed
ncopa opened this issue May 12, 2024 · 1 comment
Labels

Comments

@ncopa
Copy link

ncopa commented May 12, 2024

Issue description

Various tests fail with pytest 8.2.

Expected behavior and actual behavior

expected: tests passes.

actual:

============================================================================ short test summary info =============================================================================
ERROR stestr/tests/repository/test_file.py::TestFileRepository - AttributeError: 'TestFileRepository' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/repository/test_util.py::TestUtil - AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_bisect_return_codes.py::TestBisectReturnCodes - AttributeError: 'TestBisectReturnCodes' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_bisect_tests.py::TestBisectTests - AttributeError: 'TestBisectTests' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_config_file.py::TestTestrConf - AttributeError: 'TestTestrConf' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_load.py::TestLoadCommand - AttributeError: 'TestLoadCommand' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_output.py::TestOutput - AttributeError: 'TestOutput' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_return_codes.py::TestReturnCodes - AttributeError: 'TestReturnCodes' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_return_codes.py::TestReturnCodesToxIni - AttributeError: 'TestReturnCodesToxIni' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_run.py::TestRunCommand - AttributeError: 'TestRunCommand' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_scheduler.py::TestScheduler - AttributeError: 'TestScheduler' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_selection.py::TestSelection - AttributeError: 'TestSelection' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_selection.py::TestExclusionReader - AttributeError: 'TestExclusionReader' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_selection.py::TestConstructList - AttributeError: 'TestConstructList' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_slowest.py::TestSlowest - AttributeError: 'TestSlowest' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_subunit_trace.py::TestSubunitTrace - AttributeError: 'TestSubunitTrace' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_test_processor.py::TestTestProcessorFixture - AttributeError: 'TestTestProcessorFixture' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_user_config.py::TestUserConfig - AttributeError: 'TestUserConfig' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_user_config_return_codes.py::TestReturnCodes - AttributeError: 'TestReturnCodes' object has no attribute 'runTest'. Did you mean: 'subTest'?
ERROR stestr/tests/test_utils.py::TestUtils - AttributeError: 'TestUtils' object has no attribute 'runTest'. Did you mean: 'subTest'?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 20 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================= 1 warning, 20 errors in 0.34s ==========================================================================

Steps to reproduce the problem

Run the tests with pytest 8.2.

	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2

	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# Some tests call the "stestr" binary from the PATH so we need to make it available
	export PATH="$PATH:$PWD/.testenv/bin"
	.testenv/bin/python3 -m pytest

Specifications like the version of the project, operating system, or hardware

stestr 4.1.0

observed on x84_64 and riscv64. I expect it to happen on all architectures.

System information

  • OS: Alpine Linux edge
  • stestr version 4.1.0
  • Python release (python --version): Python 3.12.3
  • pip packages (pip freeze): ash: pip: not found

Additional information

This is reported to pytest due to similar issue in tornado. but pytest devs seem to prefer to fix it downstream:

pytest-dev/pytest#12263 (comment)

@ncopa ncopa added the bug label May 12, 2024
@ncopa
Copy link
Author

ncopa commented May 12, 2024

I think the problem is sin testtools:

==================================== ERRORS ====================================
____________ ERROR collecting stestr/tests/repository/test_file.py _____________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestFileRepository' object has no attribute 'runTest'. Did you mean: 'subTest'?
____________ ERROR collecting stestr/tests/repository/test_util.py _____________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'?
__________ ERROR collecting stestr/tests/test_bisect_return_codes.py ___________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestBisectReturnCodes' object has no attribute 'runTest'. Did you mean: 'subTest'?
______________ ERROR collecting stestr/tests/test_bisect_tests.py ______________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestBisectTests' object has no attribute 'runTest'. Did you mean: 'subTest'?
______________ ERROR collecting stestr/tests/test_config_file.py _______________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestTestrConf' object has no attribute 'runTest'. Did you mean: 'subTest'?
__________________ ERROR collecting stestr/tests/test_load.py __________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestLoadCommand' object has no attribute 'runTest'. Did you mean: 'subTest'?
_________________ ERROR collecting stestr/tests/test_output.py _________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestOutput' object has no attribute 'runTest'. Did you mean: 'subTest'?
______________ ERROR collecting stestr/tests/test_return_codes.py ______________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestReturnCodes' object has no attribute 'runTest'. Did you mean: 'subTest'?
______________ ERROR collecting stestr/tests/test_return_codes.py ______________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestReturnCodesToxIni' object has no attribute 'runTest'. Did you mean: 'subTest'?
__________________ ERROR collecting stestr/tests/test_run.py ___________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestRunCommand' object has no attribute 'runTest'. Did you mean: 'subTest'?
_______________ ERROR collecting stestr/tests/test_scheduler.py ________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestScheduler' object has no attribute 'runTest'. Did you mean: 'subTest'?
_______________ ERROR collecting stestr/tests/test_selection.py ________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestSelection' object has no attribute 'runTest'. Did you mean: 'subTest'?
_______________ ERROR collecting stestr/tests/test_selection.py ________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestExclusionReader' object has no attribute 'runTest'. Did you mean: 'subTest'?
_______________ ERROR collecting stestr/tests/test_selection.py ________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestConstructList' object has no attribute 'runTest'. Did you mean: 'subTest'?
________________ ERROR collecting stestr/tests/test_slowest.py _________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestSlowest' object has no attribute 'runTest'. Did you mean: 'subTest'?
_____________ ERROR collecting stestr/tests/test_subunit_trace.py ______________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestSubunitTrace' object has no attribute 'runTest'. Did you mean: 'subTest'?
_____________ ERROR collecting stestr/tests/test_test_processor.py _____________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestTestProcessorFixture' object has no attribute 'runTest'. Did you mean: 'subTest'?
______________ ERROR collecting stestr/tests/test_user_config.py _______________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestUserConfig' object has no attribute 'runTest'. Did you mean: 'subTest'?
________ ERROR collecting stestr/tests/test_user_config_return_codes.py ________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestReturnCodes' object has no attribute 'runTest'. Did you mean: 'subTest'?
_________________ ERROR collecting stestr/tests/test_utils.py __________________
/usr/lib/python3.12/site-packages/testtools/testcase.py:241: in __init__
    test_method = self._get_test_method()
/usr/lib/python3.12/site-packages/testtools/testcase.py:696: in _get_test_method
    return getattr(self, method_name)
E   AttributeError: 'TestUtils' object has no attribute 'runTest'. Did you mean: 'subTest'?
=============================== warnings summary ===============================
stestr/test_processor.py:30
  /home/buildozer/aports/community/py3-stestr/src/stestr-4.1.0/stestr/test_processor.py:30: PytestCollectionWarning: cannot collect test class 'TestProcessorFixture' because it has a __init__ constructor (from: stestr/test_processor.py)
    class TestProcessorFixture(fixtures.Fixture):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR stestr/tests/repository/test_file.py::TestFileRepository - AttributeErr...
ERROR stestr/tests/repository/test_util.py::TestUtil - AttributeError: 'TestU...
ERROR stestr/tests/test_bisect_return_codes.py::TestBisectReturnCodes - Attri...
ERROR stestr/tests/test_bisect_tests.py::TestBisectTests - AttributeError: 'T...
ERROR stestr/tests/test_config_file.py::TestTestrConf - AttributeError: 'Test...
ERROR stestr/tests/test_load.py::TestLoadCommand - AttributeError: 'TestLoadC...
ERROR stestr/tests/test_output.py::TestOutput - AttributeError: 'TestOutput' ...
ERROR stestr/tests/test_return_codes.py::TestReturnCodes - AttributeError: 'T...
ERROR stestr/tests/test_return_codes.py::TestReturnCodesToxIni - AttributeErr...
ERROR stestr/tests/test_run.py::TestRunCommand - AttributeError: 'TestRunComm...
ERROR stestr/tests/test_scheduler.py::TestScheduler - AttributeError: 'TestSc...
ERROR stestr/tests/test_selection.py::TestSelection - AttributeError: 'TestSe...
ERROR stestr/tests/test_selection.py::TestExclusionReader - AttributeError: '...
ERROR stestr/tests/test_selection.py::TestConstructList - AttributeError: 'Te...
ERROR stestr/tests/test_slowest.py::TestSlowest - AttributeError: 'TestSlowes...
ERROR stestr/tests/test_subunit_trace.py::TestSubunitTrace - AttributeError: ...
ERROR stestr/tests/test_test_processor.py::TestTestProcessorFixture - Attribu...
ERROR stestr/tests/test_user_config.py::TestUserConfig - AttributeError: 'Tes...
ERROR stestr/tests/test_user_config_return_codes.py::TestReturnCodes - Attrib...
ERROR stestr/tests/test_utils.py::TestUtils - AttributeError: 'TestUtils' obj...
!!!!!!!!!!!!!!!!!!! Interrupted: 20 errors during collection !!!!!!!!!!!!!!!!!!!
======================== 1 warning, 20 errors in 3.97s =========================

@ncopa ncopa closed this as completed May 12, 2024
algitbot pushed a commit to alpinelinux/aports that referenced this issue May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant