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

Tests fail because imp module is deprecated #386

Closed
dotlambda opened this issue Nov 4, 2018 · 2 comments
Closed

Tests fail because imp module is deprecated #386

dotlambda opened this issue Nov 4, 2018 · 2 comments

Comments

@dotlambda
Copy link

dotlambda commented Nov 4, 2018

When running the testsuite, I have 5 tests that fail because of DeprecationWarning: the imp module is deprecated in favour of importlib:

======================================================================
FAIL: test_errors_io (pyflakes.test.test_api.IntegrationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyflakes-2.0.0/pyflakes/test/test_api.py", line 735, in test_errors_io
    self.assertEqual(d, ('', error_msg, 1))
AssertionError: Tuples differ: ('', "/nix/store/b888dk7a2fbs1br06h996wyifbsir[297 chars]", 1) != ('', '/build/tmp2oujp6ie/temp: No such file or directory\n', 1)

First differing element 1:
"/nix/store/b888dk7a2fbs1br06h996wyifbsir[293 chars]ry\n"
'/build/tmp2oujp6ie/temp: No such file or directory\n'

- ('',
-  '/nix/store/b888dk7a2fbs1br06h996wyifbsirbxj-python3.7-setuptools-40.5.0/lib/python3.7/site-packages/site.py:26: '
-  'DeprecationWarning: the imp module is deprecated in favour of importlib; see '
-  "the module's documentation for alternative uses\n"
-  '  import imp  # Avoid import loop in Python 3\n'
-  '/build/tmp2oujp6ie/temp: No such file or directory\n',
+ ('', '/build/tmp2oujp6ie/temp: No such file or directory\n', 1)
? ++++                                                        +++

-  1)

======================================================================
FAIL: test_errors_syntax (pyflakes.test.test_api.IntegrationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyflakes-2.0.0/pyflakes/test/test_api.py", line 749, in test_errors_syntax
    self.assertEqual(d, ('', error_msg, True))
AssertionError: Tuples differ: ('', "/nix/store/b888dk7a2fbs1br06h996wyifbsir[307 chars]", 1) != ('', '/build/tmph9rduv46/temp:1:7: invalid syn[25 chars]True)

First differing element 1:
"/nix/store/b888dk7a2fbs1br06h996wyifbsir[303 chars] ^\n"
'/build/tmph9rduv46/temp:1:7: invalid syn[18 chars] ^\n'

- ('',
-  '/nix/store/b888dk7a2fbs1br06h996wyifbsirbxj-python3.7-setuptools-40.5.0/lib/python3.7/site-packages/site.py:26: '
-  'DeprecationWarning: the imp module is deprecated in favour of importlib; see '
-  "the module's documentation for alternative uses\n"
-  '  import imp  # Avoid import loop in Python 3\n'
-  '/build/tmph9rduv46/temp:1:7: invalid syntax\n'
+ ('', '/build/tmph9rduv46/temp:1:7: invalid syntax\nimport\n      ^\n', True)
? ++++                                               +++++++++++++++++ +++++++

-  'import\n'
-  '      ^\n',
-  1)

======================================================================
FAIL: test_fileWithFlakes (pyflakes.test.test_api.IntegrationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyflakes-2.0.0/pyflakes/test/test_api.py", line 724, in test_fileWithFlakes
    self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
AssertionError: Tuples differ: ("/bu[56 chars]\n", "/nix/store/b888dk7a2fbs1br06h996wyifbsir[245 chars]", 1) != ("/bu[56 chars]\n", '', 1)

First differing element 1:
"/nix/store/b888dk7a2fbs1br06h996wyifbsir[241 chars] 3\n"
''

- ("/build/tmpmzpqas06/temp:1: 'contraband' imported but unused\n",
+ ("/build/tmpmzpqas06/temp:1: 'contraband' imported but unused\n", '', 1)
?                                                                  +++++++

-  '/nix/store/b888dk7a2fbs1br06h996wyifbsirbxj-python3.7-setuptools-40.5.0/lib/python3.7/site-packages/site.py:26: '
-  'DeprecationWarning: the imp module is deprecated in favour of importlib; see '
-  "the module's documentation for alternative uses\n"
-  '  import imp  # Avoid import loop in Python 3\n',
-  1)

======================================================================
FAIL: test_goodFile (pyflakes.test.test_api.IntegrationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyflakes-2.0.0/pyflakes/test/test_api.py", line 712, in test_goodFile
    self.assertEqual(d, ('', '', 0))
AssertionError: Tuples differ: ('', "/nix/store/b888dk7a2fbs1br06h996wyifbsir[245 chars]", 0) != ('', '', 0)

First differing element 1:
"/nix/store/b888dk7a2fbs1br06h996wyifbsir[241 chars] 3\n"
''

+ ('', '', 0)
- ('',
-  '/nix/store/b888dk7a2fbs1br06h996wyifbsirbxj-python3.7-setuptools-40.5.0/lib/python3.7/site-packages/site.py:26: '
-  'DeprecationWarning: the imp module is deprecated in favour of importlib; see '
-  "the module's documentation for alternative uses\n"
-  '  import imp  # Avoid import loop in Python 3\n',
-  0)

======================================================================
FAIL: test_readFromStdin (pyflakes.test.test_api.IntegrationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyflakes-2.0.0/pyflakes/test/test_api.py", line 757, in test_readFromStdin
    self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
AssertionError: Tuples differ: ("<st[40 chars]\n", "/nix/store/b888dk7a2fbs1br06h996wyifbsir[245 chars]", 1) != ("<st[40 chars]\n", '', 1)

First differing element 1:
"/nix/store/b888dk7a2fbs1br06h996wyifbsir[241 chars] 3\n"
''

- ("<stdin>:1: 'contraband' imported but unused\n",
+ ("<stdin>:1: 'contraband' imported but unused\n", '', 1)
?                                                  +++++++

-  '/nix/store/b888dk7a2fbs1br06h996wyifbsirbxj-python3.7-setuptools-40.5.0/lib/python3.7/site-packages/site.py:26: '
-  'DeprecationWarning: the imp module is deprecated in favour of importlib; see '
-  "the module's documentation for alternative uses\n"
-  '  import imp  # Avoid import loop in Python 3\n',
-  1)

----------------------------------------------------------------------
@dotlambda
Copy link
Author

See pypa/setuptools#479.

@asottile
Copy link
Member

asottile commented Jan 3, 2019

these seem to be coming from your site.py and not from pyflakes or its test suite.

To confirm, here's an invocation of pyflakes test suite with warnings as errors:

$ python3.7 -Werror -m unittest discover pyflakes
......................................s..........s.......s...................s..............................s...s.............s...............................s....................................................s..................s......s...............................................s............ss..s.........s.s.................s...s.............s...............................s.................................................................................s..................s......s...........................................................s.....................sss.....................................s............ss..s.........s.s.
----------------------------------------------------------------------
Ran 643 tests in 0.736s

OK (skipped=34)

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

3 participants