Skip to content

Build failure on Python 3.9 #3457

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

Closed
limburgher opened this issue Mar 26, 2020 · 6 comments
Closed

Build failure on Python 3.9 #3457

limburgher opened this issue Mar 26, 2020 · 6 comments

Comments

@limburgher
Copy link

2.4.4 on Fedora rawhide with Python 3.9.0a5:
https://bugzilla.redhat.com/show_bug.cgi?id=1817686

@PCManticore
Copy link
Contributor

Thanks for the report. 3.9 is not yet supported but pushed some fixes for the most obvious failures.

@limburgher
Copy link
Author

Thank you! There are additional failures:

=================================== FAILURES ===================================
_____________________ test_functional[unhashable_dict_key] _____________________

test_file = FunctionalTest:unhashable_dict_key

@pytest.mark.parametrize("test_file", TESTS, ids=TESTS_NAMES)
def test_functional(test_file):
    LintTest = (
        LintModuleOutputUpdate(test_file) if UPDATE else LintModuleTest(test_file)
    )
    LintTest.setUp()
  LintTest._runTest()

tests/test_functional.py:396:


tests/test_functional.py:321: in _runTest
self._linter.check(modules_to_check)
pylint/lint.py:1004: in check
self._do_check(files_or_modules)
pylint/lint.py:1165: in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
pylint/lint.py:1252: in check_astroid_module
walker.walk(ast_node)
pylint/utils/ast_walker.py:77: in walk
self.walk(child)
pylint/utils/ast_walker.py:77: in walk
self.walk(child)
pylint/utils/ast_walker.py:74: in walk
callback(astroid)
pylint/checkers/typecheck.py:1600: in visit_subscript
inferred = safe_infer(node.slice.value)


self = <List.list l.7 at 0x7f233ce6d6d0>, name = 'value'

def __getattr__(self, name):
    if name == "_proxied":
        return getattr(self.__class__, "_proxied")
    if name in self.__dict__:
        return self.__dict__[name]
  return getattr(self._proxied, name)

E AttributeError: 'ClassDef' object has no attribute 'value'

/usr/lib/python3.9/site-packages/astroid/bases.py:110: AttributeError
_____________________ test_functional[consider_using_get] ______________________

test_file = FunctionalTest:consider_using_get

@pytest.mark.parametrize("test_file", TESTS, ids=TESTS_NAMES)
def test_functional(test_file):
    LintTest = (
        LintModuleOutputUpdate(test_file) if UPDATE else LintModuleTest(test_file)
    )
    LintTest.setUp()
  LintTest._runTest()

tests/test_functional.py:396:


self = <test_functional.LintModuleTest object at 0x7f2336264970>

def _runTest(self):
    modules_to_check = [self._test_file.source]
    self._linter.check(modules_to_check)
    expected_messages, expected_text = self._get_expected()
    received_messages, received_text = self._get_received()

    if expected_messages != received_messages:
        msg = ['Wrong results for file "%s":' % (self._test_file.base)]
        missing, unexpected = multiset_difference(
            expected_messages, received_messages
        )
        if missing:
            msg.append("\nExpected in testdata:")
            msg.extend(" %3d: %s" % msg for msg in sorted(missing))
        if unexpected:
            msg.append("\nUnexpected in testdata:")
            msg.extend(" %3d: %s" % msg for msg in sorted(unexpected))
      pytest.fail("\n".join(msg))

E Failed: Wrong results for file "consider_using_get":
E
E Expected in testdata:
E 5: consider-using-get
E 8: consider-using-get
E 13: consider-using-get
E 67: consider-using-get

tests/test_functional.py:336: Failed
__________________ test_functional[consider_using_enumerate] ___________________

test_file = FunctionalTest:consider_using_enumerate

@pytest.mark.parametrize("test_file", TESTS, ids=TESTS_NAMES)
def test_functional(test_file):
    LintTest = (
        LintModuleOutputUpdate(test_file) if UPDATE else LintModuleTest(test_file)
    )
    LintTest.setUp()
  LintTest._runTest()

tests/test_functional.py:396:


self = <test_functional.LintModuleTest object at 0x7f2337b5a5b0>

def _runTest(self):
    modules_to_check = [self._test_file.source]
    self._linter.check(modules_to_check)
    expected_messages, expected_text = self._get_expected()
    received_messages, received_text = self._get_received()

    if expected_messages != received_messages:
        msg = ['Wrong results for file "%s":' % (self._test_file.base)]
        missing, unexpected = multiset_difference(
            expected_messages, received_messages
        )
        if missing:
            msg.append("\nExpected in testdata:")
            msg.extend(" %3d: %s" % msg for msg in sorted(missing))
        if unexpected:
            msg.append("\nUnexpected in testdata:")
            msg.extend(" %3d: %s" % msg for msg in sorted(unexpected))
      pytest.fail("\n".join(msg))

E Failed: Wrong results for file "consider_using_enumerate":
E
E Expected in testdata:
E 7: consider-using-enumerate
E 9: consider-using-enumerate
E 17: consider-using-enumerate
E 21: consider-using-enumerate

tests/test_functional.py:336: Failed
=============================== warnings summary ===============================
tests/test_func.py::test_functionality[func_excess_escapes.py]
:7: DeprecationWarning: invalid escape sequence [

tests/test_func.py::test_functionality[func_excess_escapes.py]
:8: DeprecationWarning: invalid escape sequence /

tests/test_func.py::test_functionality[func_excess_escapes.py]
:9: DeprecationWarning: invalid escape sequence `

tests/test_func.py::test_functionality[func_excess_escapes.py]
:15: DeprecationWarning: invalid escape sequence \o

tests/test_func.py::test_functionality[func_excess_escapes.py]
:17: DeprecationWarning: invalid escape sequence \8

tests/test_func.py::test_functionality[func_excess_escapes.py]
:27: DeprecationWarning: invalid escape sequence \P

tests/test_functional.py::test_functional[future_unicode_literals]
tests/test_functional.py::test_functional[anomalous_unicode_escape_py3]
:5: DeprecationWarning: invalid escape sequence \u

tests/test_functional.py::test_functional[anomalous_unicode_escape_py3]
:6: DeprecationWarning: invalid escape sequence \U

tests/test_functional.py::test_functional[anomalous_unicode_escape_py3]
:8: DeprecationWarning: invalid escape sequence \N

-- Docs: https://docs.pytest.org/en/latest/warnings.html
= 3 failed, 1086 passed, 43 skipped, 202 deselected, 10 warnings in 178.76 seconds =

@PCManticore
Copy link
Contributor

@limburgher Thanks, have you tried with the latest master branch? The tests should all pass with the latest code, but let me know if that's not the case.

@limburgher
Copy link
Author

Lots of:

def expand_modules(files_or_modules, black_list, black_list_re):
"""take a list of files/modules/packages and return the list of tuple
(file, module name) which have to be actually checked
"""
result = []
errors = []
path = sys.path.copy()

    for something in files_or_modules:
        if os.path.basename(something) in black_list:
            continue
        if _basename_in_blacklist_re(os.path.basename(something), black_list_re):
            continue

        module_path = get_python_path(something)
        additional_search_path = [module_path] + path
        if os.path.exists(something):
            # this is a file or a directory
            try:
                modname = ".".join(
                  modutils.modpath_from_file(something, path=additional_search_path)
                )

E TypeError: modpath_from_file() got an unexpected keyword argument 'path'

@PCManticore
Copy link
Contributor

You also need to use astroid installed from the master branch.

@limburgher
Copy link
Author

Better!

=================================== FAILURES ===================================
____________________________ TestRunTC.test_version ____________________________

self = <test_self.TestRunTC object at 0x7f2427ee2d00>

def test_version(self):
    def check(lines):
        assert lines[0].startswith("pylint ")
        assert lines[1].startswith("astroid ")
        assert lines[2].startswith("Python ")

    out = StringIO()
    self._run_pylint(["--version"], out=out)
    check(out.getvalue().splitlines())
  result = subprocess.check_output([sys.executable, "-m", "pylint", "--version"])

tests/test_self.py:616:


/usr/lib64/python3.9/subprocess.py:419: in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,


input = None, capture_output = False, timeout = None, check = True
popenargs = (['/usr/bin/python3', '-m', 'pylint', '--version'],)
kwargs = {'stdout': -1}
process = <Popen: returncode: 1 args: ['/usr/bin/python3', '-m', 'pylint', '--version']>
stdout = b'', stderr = None, retcode = 1

def run(*popenargs,
        input=None, capture_output=False, timeout=None, check=False, **kwargs):
    """Run command with arguments and return a CompletedProcess instance.

    The returned instance will have attributes args, returncode, stdout and
    stderr. By default, stdout and stderr are not captured, and those attributes
    will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.

    If check is True and the exit code was non-zero, it raises a
    CalledProcessError. The CalledProcessError object will have the return code
    in the returncode attribute, and output & stderr attributes if those streams
    were captured.

    If timeout is given, and the process takes too long, a TimeoutExpired
    exception will be raised.

    There is an optional argument "input", allowing you to
    pass bytes or a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it will be used internally.

    By default, all communication is in bytes, and therefore any "input" should
    be bytes, and the stdout and stderr will be bytes. If in text mode, any
    "input" should be a string, and stdout and stderr will be strings decoded
    according to locale encoding, or by "encoding" if set. Text mode is
    triggered by setting any of text, encoding, errors or universal_newlines.

    The other arguments are the same as for the Popen constructor.
    """
    if input is not None:
        if kwargs.get('stdin') is not None:
            raise ValueError('stdin and input arguments may not both be used.')
        kwargs['stdin'] = PIPE

    if capture_output:
        if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
            raise ValueError('stdout and stderr arguments may not be used '
                             'with capture_output.')
        kwargs['stdout'] = PIPE
        kwargs['stderr'] = PIPE

    with Popen(*popenargs, **kwargs) as process:
        try:
            stdout, stderr = process.communicate(input, timeout=timeout)
        except TimeoutExpired as exc:
            process.kill()
            if _mswindows:
                # Windows accumulates the output in a single blocking
                # read() call run on child threads, with the timeout
                # being done in a join() on those threads.  communicate()
                # _after_ kill() is required to collect that and add it
                # to the exception.
                exc.stdout, exc.stderr = process.communicate()
            else:
                # POSIX _communicate already populated the output so
                # far into the TimeoutExpired exception.
                process.wait()
            raise
        except:  # Including KeyboardInterrupt, communicate handled that.
            process.kill()
            # We don't call process.wait() as .__exit__ does that for us.
            raise
        retcode = process.poll()
        if check and retcode:
          raise CalledProcessError(retcode, process.args,
                                     output=stdout, stderr=stderr)

E subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pylint', '--version']' returned non-zero exit status 1.

/usr/lib64/python3.9/subprocess.py:533: CalledProcessError
----------------------------- Captured stderr call -----------------------------

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