-
-
Notifications
You must be signed in to change notification settings - Fork 146
3.7.0: pytest is failing in tests/test_pytest_mock.py::test_standalone_mock
unit
#276
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
Comments
Hi @kloczek, Can you confirm that the package |
This actually tests that the 'mock' module is being used when use_standalone_mock is true. It also skips the test if 'mock' is not installed. Close pytest-dev#276
I can reproduce the same error if I install I've changed that test's approach in #277, which I'm sure will work for you then. Do you need a new release with that fix? |
IMO it would be really better to switch to |
This plugin has always used |
Exactly, thanks @The-Compiler. Closing this then. 👍 |
Even with installed 'mock` pytest is failing. + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mock-3.7.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mock-3.7.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:relaxed --deselect tests/test_pytest_mock.py::test_detailed_introspection --deselect tests/test_pytest_mock.py::test_detailed_introspection_async
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-mock-3.7.0, configfile: tox.ini
plugins: mock-3.7.0, asyncio-0.18.2
asyncio: mode=auto
collected 72 items / 2 deselected / 70 selected
tests/test_pytest_mock.py .........................................................F............ [100%]
================================================================================= FAILURES =================================================================================
___________________________________________________________________________ test_standalone_mock ___________________________________________________________________________
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-155/test_standalone_mock0')>
def test_standalone_mock(testdir: Any) -> None:
"""Check that the "mock_use_standalone" is being used."""
testdir.makepyfile(
"""
def test_foo(mocker):
pass
"""
)
testdir.makeini(
"""
[pytest]
mock_use_standalone_module = true
"""
)
result = testdir.runpytest_subprocess()
> assert result.ret == 3
E assert <ExitCode.OK: 0> == 3
E + where <ExitCode.OK: 0> = <RunResult ret=ExitCode.OK len(stdout.lines)=16 len(stderr.lines)=0 duration=0.37s>.ret
/home/tkloczko/rpmbuild/BUILD/pytest-mock-3.7.0/tests/test_pytest_mock.py:723: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-155/test_standalone_mock0/runpytest-0
in: /tmp/pytest-of-tkloczko/pytest-155/test_standalone_mock0
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-7.1.1, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-155/test_standalone_mock0, configfile: tox.ini
plugins: mock-3.7.0, asyncio-0.18.2
asyncio: mode=legacy
collected 1 item
test_standalone_mock.py . [100%]
=============================== warnings summary ===============================
../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191
/usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 passed, 1 warning in 0.02s =========================
============================================================================= warnings summary =============================================================================
tests/test_pytest_mock.py::test_patch_context_manager_with_context_manager
/usr/lib/python3.8/site-packages/_pytest/python.py:192: PytestRemovedIn8Warning: Passing None has been deprecated.
See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.
result = testfunction(**testargs)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
FAILED tests/test_pytest_mock.py::test_standalone_mock - assert <ExitCode.OK: 0> == 3
========================================================== 1 failed, 69 passed, 2 deselected, 1 warning in 4.36s =========================================================== |
Oh I forgot to merge #277. Should work now on the current |
What about push all those changes as new version? 😋 |
|
Looks clean now. Thank you 👍 + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mock-3.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mock-3.8.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-mock-3.8.1, configfile: tox.ini
plugins: mock-3.8.1, asyncio-0.18.2
asyncio: mode=auto
collected 73 items
tests/test_pytest_mock.py ......................................................................... [100%]
============================================================================ 73 passed in 3.92s ============================================================================ |
I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output:
The text was updated successfully, but these errors were encountered: