Skip to content

Astroid is breaking a pylint benchmark tests #909

Closed
@Pierre-Sassoulas

Description

@Pierre-Sassoulas

Steps to reproduce

Have a pylint repo, then do:

git clone git@github.com:PyCQA/astroid.git
pip3 uninstall astroid;pip3 install -e astroid/;python3 -m pytest tests -k test_baseline_benchmark_j1_all_checks_lots_of_files

Current behavior

===========FAILURES ================
___TestEstablishBaselineBenchmarks.test_baseline_benchmark_j1_all_checks_lots_of_files ___

self = <test_baseline_benchmarks.TestEstablishBaselineBenchmarks object at 0x7f36b5737280>, benchmark = <pytest_benchmark.fixture.BenchmarkFixture object at 0x7f36b5737070>

    def test_baseline_benchmark_j1_all_checks_lots_of_files(self, benchmark):
        """Runs lots of files, with -j1, against all plug-ins
    
        ... that's the intent at least.
        """
        if benchmark.disabled:
            benchmark(print, "skipping, only benchmark large file counts")
            return  # _only_ run this test is profiling
        linter = PyLinter()
    
        # Register all checkers/extensions and enable them
>       register_plugins(
            linter, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
        )

tests/benchmark/test_baseline_benchmarks.py:343: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pylint/utils/utils.py:254: in register_plugins
    module = modutils.load_module_from_file(
astroid/astroid/modutils.py:226: in load_module_from_file
    return load_module_from_modpath(modpath)
astroid/astroid/modutils.py:211: in load_module_from_modpath
    return load_module_from_name(".".join(parts))
astroid/astroid/modutils.py:196: in load_module_from_name
    return importlib.import_module(dotted_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = '.git', package = None

    def import_module(name, package=None):
        """Import a module.
    
        The 'package' argument is required when performing a relative import. It
        specifies the package to use as the anchor point from which to resolve the
        relative import to an absolute import.
    
        """
        level = 0
        if name.startswith('.'):
            if not package:
                msg = ("the 'package' argument is required to perform a relative "
                       "import for {!r}")
>               raise TypeError(msg.format(name))
E               TypeError: the 'package' argument is required to perform a relative import for '.git'

/usr/lib/python3.8/importlib/__init__.py:122: TypeError

I bissected the problem and it appear on this commit : ac2b173

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions