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

Update tests for bleeding-edge astroid namespace package changes #7058

Closed
jacobtylerwalls opened this issue Jun 25, 2022 · 2 comments · Fixed by #7153
Closed

Update tests for bleeding-edge astroid namespace package changes #7058

jacobtylerwalls opened this issue Jun 25, 2022 · 2 comments · Fixed by #7153
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow Needs astroid update Needs an astroid update (probably a release too) before being mergable Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@jacobtylerwalls
Copy link
Member

Bug description

TestRunTC.test_regression_parallel_mode_without_filepath _______________________________________

self = <test_self.TestRunTC object at 0x10467f9d0>

def test_regression_parallel_mode_without_filepath(self) -> None:
    # Test that parallel mode properly passes filepath
    # https://github.com/PyCQA/pylint/issues/3564
    path = join(
        HERE, "regrtest_data", "regression_missing_init_3564", "subdirectory/"
    )
  self._test_output([path, "-j2"], expected_output="No such file or directory")

tests/test_self.py:1063:


self = <test_self.TestRunTC object at 0x10467f9d0>
args = ['--rcfile=/Users/.../pylint/pylint/testutils/testing_pylintrc', '/Users/.../pylint/tests/regrtest_data/regression_missing_init_3564/subdirectory/', '-j2']
expected_output = 'No such file or directory'

def _test_output(self, args: list[str], expected_output: str) -> None:
    out = StringIO()
    args = _add_rcfile_default_pylintrc(args)
    self._run_pylint(args, out=out)
    actual_output = self._clean_paths(out.getvalue())
    expected_output = self._clean_paths(expected_output)
  assert expected_output.strip() in actual_output.strip()

E AssertionError: assert 'No such file or directory' in ''
E + where 'No such file or directory' = <built-in method strip of str object at 0x104692d50>()
E + where <built-in method strip of str object at 0x104692d50> = 'No such file or directory'.strip
E + and '' = <built-in method strip of str object at 0x100bc8670>()
E + where <built-in method strip of str object at 0x100bc8670> = ''.strip

tests/test_self.py:170: AssertionError

TestRunTC.test_regression_recursive

self = <test_self.TestRunTC object at 0x10465b1c0>

def test_regression_recursive(self):
    """Tests if error is raised when linter is executed over directory not using --recursive=y"""
  self._test_output(
        [join(HERE, "regrtest_data", "directory", "subdirectory"), "--recursive=n"],
        expected_output="No such file or directory",
    )

tests/test_self.py:1233:


self = <test_self.TestRunTC object at 0x10465b1c0>
args = ['--rcfile=/Users/.../pylint/pylint/testutils/testing_pylintrc', '/Users/.../pylint/tests/regrtest_data/directory/subdirectory', '--recursive=n']
expected_output = 'No such file or directory'

def _test_output(self, args: list[str], expected_output: str) -> None:
    out = StringIO()
    args = _add_rcfile_default_pylintrc(args)
    self._run_pylint(args, out=out)
    actual_output = self._clean_paths(out.getvalue())
    expected_output = self._clean_paths(expected_output)
  assert expected_output.strip() in actual_output.strip()

E AssertionError: assert 'No such file or directory' in ''
E + where 'No such file or directory' = <built-in method strip of str object at 0x104692d50>()
E + where <built-in method strip of str object at 0x104692d50> = 'No such file or directory'.strip
E + and '' = <built-in method strip of str object at 0x100bc8670>()
E + where <built-in method strip of str object at 0x100bc8670> = ''.strip

tests/test_self.py:170: AssertionError

TestRunTC.test_regression_recursive_current_dir

self = <test_self.TestRunTC object at 0x10465b2b0>

def test_regression_recursive_current_dir(self):
    with _test_sys_path():
        # pytest is including directory HERE/regrtest_data to sys.path which causes
        # astroid to believe that directory is a package.
        sys.path = [
            path
            for path in sys.path
            if not os.path.basename(path) == "regrtest_data"
        ]
        with _test_cwd():
            os.chdir(join(HERE, "regrtest_data", "directory"))
            breakpoint()
          self._test_output(
                ["."],
                expected_output="No such file or directory",
            )

tests/test_self.py:1345:


self = <test_self.TestRunTC object at 0x10465b2b0>, args = ['--rcfile=/Users/.../pylint/pylint/testutils/testing_pylintrc', '.']
expected_output = 'No such file or directory'

def _test_output(self, args: list[str], expected_output: str) -> None:
    out = StringIO()
    args = _add_rcfile_default_pylintrc(args)
    self._run_pylint(args, out=out)
    actual_output = self._clean_paths(out.getvalue())
    expected_output = self._clean_paths(expected_output)
  assert expected_output.strip() in actual_output.strip()

E AssertionError: assert 'No such file or directory' in ''
E + where 'No such file or directory' = <built-in method strip of str object at 0x104692d50>()
E + where <built-in method strip of str object at 0x104692d50> = 'No such file or directory'.strip
E + and '' = <built-in method strip of str object at 0x100bc8670>()
E + where <built-in method strip of str object at 0x100bc8670> = ''.strip

tests/test_self.py:170: AssertionError
======================================================= short test summary info ========================================================
FAILED tests/test_self.py::TestRunTC::test_regression_parallel_mode_without_filepath - AssertionError: assert 'No such file or direct...
FAILED tests/test_self.py::TestRunTC::test_regression_recursive - AssertionError: assert 'No such file or directory' in ''
FAILED tests/test_self.py::TestRunTC::test_regression_recursive_current_dir - AssertionError: assert 'No such file or directory' in ''
================================================== 3 failed, 121 deselected in 44.75s ==================================================

Configuration

No response

Command used

pytest tests/test_self.py

Pylint output

see above

Expected behavior

n/a

Pylint version

pylint 2.15.0-dev0
astroid 2.12.0-dev0
Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)]

OS / Environment

macOS

Additional dependencies

No response

@jacobtylerwalls jacobtylerwalls added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 25, 2022
@DanielNoord
Copy link
Collaborator

Those have been happening for some weeks. Should have probably reported but thought it was something to do with my own environment.

@jacobtylerwalls jacobtylerwalls changed the title Test failures on macOS in test_self.py Update tests for bleeding-edge astroid namespace package changes Jun 25, 2022
@jacobtylerwalls
Copy link
Member Author

I've been ignoring it also. It's bleeding-edge astroid. I guess we can close since we'll just deal with later. But at a glance, the failures look better: instead of saying we can't lint a package with a missing __init__.py, we lint it.

@Pierre-Sassoulas Pierre-Sassoulas added Maintenance Discussion or action around maintaining pylint or the dev workflow Needs astroid update Needs an astroid update (probably a release too) before being mergable Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 26, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.15.0 milestone Jun 26, 2022
@jacobtylerwalls jacobtylerwalls linked a pull request Jul 9, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow Needs astroid update Needs an astroid update (probably a release too) before being mergable Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants