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

pytest-mock-1.6.0: test failure with python-3.x #81

Closed
0-wiz-0 opened this issue Apr 4, 2017 · 2 comments
Closed

pytest-mock-1.6.0: test failure with python-3.x #81

0-wiz-0 opened this issue Apr 4, 2017 · 2 comments

Comments

@0-wiz-0
Copy link

0-wiz-0 commented Apr 4, 2017

When running the tests for pytest-mock-1.6.0 (pypi distfile) on NetBSD
with python-3.6.1, there is one test failure:

============================================================================= test session starts =============================================================================
platform netbsd7 -- Python 3.6.1, pytest-3.0.7, py-1.4.30, pluggy-0.4.0
rootdir: .../pytest-mock-1.6.0, inifile:
plugins: mock-1.6.0
collected 43 items 

test_pytest_mock.py .........................................F.

================================================================================== FAILURES ===================================================================================
____________________________________________________________________________ test_standalone_mock _____________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-pbulk/pytest-3/testdir/test_standalone_mock0')>

    @pytest.mark.skipif(sys.version_info[0] < 3, reason='Py3 only')
    def test_standalone_mock(testdir):
        """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 = runpytest_subprocess(testdir)
>       assert result.ret == 3
E       assert 0 == 3
E        +  where 0 = <_pytest.pytester.RunResult object at 0x799b317012d8>.ret

.../pytest-mock-1.6.0/test_pytest_mock.py:503: AssertionError
---------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------
running: /usr/pkg/bin/python3.6 /usr/pkg/lib/python3.6/site-packages/pytest.py --basetemp=/tmp/pytest-of-pbulk/pytest-3/testdir/test_standalone_mock0/runpytest-0
     in: /tmp/pytest-of-pbulk/pytest-3/testdir/test_standalone_mock0
============================= test session starts ==============================
platform netbsd7 -- Python 3.6.1, pytest-3.0.7, py-1.4.30, pluggy-0.4.0
rootdir: /tmp/pytest-of-pbulk/pytest-3/testdir/test_standalone_mock0, inifile: tox.ini
plugins: mock-1.6.0
collected 1 items

test_standalone_mock.py .

=========================== 1 passed in 0.01 seconds ===========================
===================================================================== 1 failed, 42 passed in 1.72 seconds =====================================================================
*** Error code 1

@nicoddemus
Copy link
Member

Hi, thanks for the report.

Are you running in your own environment or using tox?

This test is supposed to fail (ret == 3) because the running environment shouldn't have the standalone mock module installed, but it is succeeding.

Please see if you can run the test suite using tox -e py36 instead.

@0-wiz-0
Copy link
Author

0-wiz-0 commented Apr 5, 2017

Sorry, that was a misunderstanding on my side. I thought mock was always needed.

I as testing in a local environment. When I remove mock, everything's fine.

@0-wiz-0 0-wiz-0 closed this as completed Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants