Fix errors related to warnings raised on pypy test environment
For some reason pypy raises this warning in the line that the catch_warnings block was added: ______________________________ ERROR collecting ______________________________ C:\ProgramData\chocolatey\lib\python.pypy\tools\pypy2-v5.4.1-win32\lib-python\2.7\pkgutil.py:476: in find_loader loader = importer.find_module(fullname) c:\pytest\.tox\pypy\site-packages\_pytest\assertion\rewrite.py:75: in find_module fd, fn, desc = imp.find_module(lastname, path) <builtin>/?:3: in anonymous ??? E ImportWarning: Not importing directory 'c:\users\bruno\appdata\local\temp\pytest-of-Bruno\pytest-3192\testdir\test_cmdline_python_package0' missing __init__.py
This commit is contained in:
parent
2c730743f1
commit
74b54ac0ec
|
@ -530,6 +530,7 @@ class TestInvocationVariants(object):
|
|||
])
|
||||
|
||||
def test_cmdline_python_package(self, testdir, monkeypatch):
|
||||
import warnings
|
||||
monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False)
|
||||
path = testdir.mkpydir("tpkg")
|
||||
path.join("test_hello.py").write("def test_hello(): pass")
|
||||
|
@ -552,7 +553,11 @@ class TestInvocationVariants(object):
|
|||
return what
|
||||
empty_package = testdir.mkpydir("empty_package")
|
||||
monkeypatch.setenv('PYTHONPATH', join_pythonpath(empty_package))
|
||||
result = testdir.runpytest("--pyargs", ".")
|
||||
# the path which is not a package raises a warning on pypy;
|
||||
# no idea why only pypy and not normal python warn about it here
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter('ignore', ImportWarning)
|
||||
result = testdir.runpytest("--pyargs", ".")
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*2 passed*"
|
||||
|
|
Loading…
Reference in New Issue