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 failure with disabled byte-compilation #206

Closed
pytestbot opened this issue Oct 22, 2012 · 1 comment
Closed

Test failure with disabled byte-compilation #206

pytestbot opened this issue Oct 22, 2012 · 1 comment
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Arfrever Frehtes Taifersar Arahesis (BitBucket: arfrever, GitHub: arfrever)


1 test failure occurs when byte-compilation is disabled (e.g. using PYTHONDONTWRITEBYTECODE environmental variable). This problem was introduced in pytest 2.3.0.

Results for pytest hg tip:

$ PYTHONDONTWRITEBYTECODE="1" python2.7 pytest.py
============================= test session starts ==============================
platform linux2 -- Python 2.7.4 -- pytest-2.3.2.dev2
collected 839 items

doc/en/example/assertion/test_failures.py .
doc/en/example/assertion/test_setup_flow_example.py ..
doc/en/example/assertion/global_testmodule_config/test_hello.py .
doc/en/example/costlysetup/sub1/test_quick.py .
doc/en/example/costlysetup/sub2/test_two.py ..
doc/en/example/py2py3/test_py2.py .
doc/en/example/py2py3/test_py3.py .
testing/acceptance_test.py ......................................x.......
testing/test_assertinterpret.py ..........................s
testing/test_assertion.py ........................
testing/test_assertrewrite.py ...................F..
testing/test_capture.py ..............x....................
testing/test_collection.py ...........x...................
testing/test_config.py ........x................
testing/test_conftest.py ..............................
testing/test_core.py ...................................................
testing/test_doctest.py .........
testing/test_genscript.py .....sss
testing/test_helpconfig.py ........
testing/test_junitxml.py ......................
testing/test_mark.py ...................................
testing/test_monkeypatch.py ......................
testing/test_nose.py ..........
testing/test_parseopt.py ............
testing/test_pastebin.py ...
testing/test_pdb.py ............
testing/test_pytester.py x.......
testing/test_python.py ...................................................................................................................................x........................................
testing/test_recwarn.py ........
testing/test_resultlog.py .........
testing/test_runner.py .................sssssss..ssss.......x........
testing/test_runner_xunit.py ..........
testing/test_session.py ...............
testing/test_skipping.py ...................................
testing/test_terminal.py .................................s............................
testing/test_tmpdir.py ......
testing/test_unittest.py ...........................

=================================== FAILURES ===================================
_____________________ TestRewriteOnImport.test_pyc_vs_pyo ______________________

self = <test_assertrewrite.TestRewriteOnImport instance at 0x2cb5c20>
testdir = <TmpTestdir local('/tmp/pytest-0/testdir/test_pyc_vs_pyo0/test_pyc_vs_pyo')>
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x2cb5758>

    @pytest.mark.skipif('"__pypy__" in sys.modules')
    def test_pyc_vs_pyo(self, testdir, monkeypatch):
        testdir.makepyfile("""
    import pytest
    def test_optimized():
        "hello"
        assert test_optimized.__doc__ is None""")
        p = py.path.local.make_numbered_dir(prefix="runpytest-", keep=None,
                                            rootdir=testdir.tmpdir)
        tmp = "--basetemp=%s" % p
        monkeypatch.setenv("PYTHONOPTIMIZE", "2")
        assert testdir.runpybin("py.test", tmp).ret == 0
        tagged = "test_pyc_vs_pyo." + PYTEST_TAG
>       assert tagged + ".pyo" in os.listdir("__pycache__")
E       OSError: [Errno 2] No such file or directory: '__pycache__'

/tmp/pytest/testing/test_assertrewrite.py:367: OSError
------------------------------- Captured stdout --------------------------------
running ['/usr/bin/python2.7', '/tmp/pytest/pytest.py', '--basetemp=/tmp/pytest-0/testdir/test_pyc_vs_pyo0/test_pyc_vs_pyo/runpytest-0'] curdir= /tmp/pytest-0/testdir/test_pyc_vs_pyo0/test_pyc_vs_pyo
============================= test session starts ==============================
platform linux2 -- Python 2.7.4 -- pytest-2.3.2.dev2
collected 1 items

test_pyc_vs_pyo.py .

=========================== 1 passed in 0.03 seconds ===========================
------------------------------- Captured stderr --------------------------------
WARNING: assertions which are not in test modules will be ignored because assert statements are not executed by the underlying Python interpreter (are you using python -O?)
=========================== short test summary info ============================
XFAIL testing/acceptance_test.py::TestInvocationVariants::()::test_noclass_discovery_if_not_testcase
  decide: feature or bug
XFAIL testing/test_capture.py::TestPerTestCapturing::()::test_capture_scope_cache
XFAIL testing/test_collection.py::TestPrunetraceback::()::test_collect_report_postprocessing
  other mechanism for adding to reporting needed
XFAIL testing/test_config.py::TestParseIni::()::test_confcutdir
  probably not needed
XFAIL testing/test_pytester.py::test_reportrecorder
  reason: internal reportrecorder tests need refactoring
XFAIL testing/test_python.py::TestAutouseDiscovery::()::test_setup_enabled_functionnode
  'enabled' feature not implemented
XFAIL testing/test_runner.py::test_runtest_in_module_ordering
SKIP [2] /tmp/pytest/_pytest/core.py:121: plugin 'xdist' is missing
SKIP [11] /tmp/pytest/testing/test_runner.py:277: could not import 'xdist.plugin'
SKIP [1] /tmp/pytest/_pytest/skipping.py:120: condition: sys.version_info >= (2,6)
SKIP [1] /tmp/pytest/testing/conftest.py:109: no suitable jython found
SKIP [1] /tmp/pytest/testing/conftest.py:109: no suitable pypy found
======== 1 failed, 815 passed, 16 skipped, 7 xfailed in 756.22 seconds =========

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


fix issue206 - unset PYTHONDONTWRITEBYTECODE in assertrewrite test

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant