Skip to content

Commit 74b54ac

Browse files
committed
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
1 parent 2c73074 commit 74b54ac

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

testing/acceptance_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ def test_pyargs_importerror(self, testdir, monkeypatch):
530530
])
531531

532532
def test_cmdline_python_package(self, testdir, monkeypatch):
533+
import warnings
533534
monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False)
534535
path = testdir.mkpydir("tpkg")
535536
path.join("test_hello.py").write("def test_hello(): pass")
@@ -552,7 +553,11 @@ def join_pythonpath(what):
552553
return what
553554
empty_package = testdir.mkpydir("empty_package")
554555
monkeypatch.setenv('PYTHONPATH', join_pythonpath(empty_package))
555-
result = testdir.runpytest("--pyargs", ".")
556+
# the path which is not a package raises a warning on pypy;
557+
# no idea why only pypy and not normal python warn about it here
558+
with warnings.catch_warnings():
559+
warnings.simplefilter('ignore', ImportWarning)
560+
result = testdir.runpytest("--pyargs", ".")
556561
assert result.ret == 0
557562
result.stdout.fnmatch_lines([
558563
"*2 passed*"

0 commit comments

Comments
 (0)