coherent-oss / pytest-flake8

pytest plugin to run flake8
MIT License
1 stars 1 forks source link

'flake8.options.config' has no attribute 'load_config' #1

Closed brherger closed 4 months ago

brherger commented 4 months ago

With release v1.1.2 or v1.1.3 we are encountering the exception below. This did not occur with v1.1.1.

    def check_file(
        path, flake8ignore, maxlength, maxdoclenght, maxcomplexity, showsource, statistics
    ):
        """Run flake8 over a single file, and return the number of failures."""
        args = []
        if maxlength:
            args += ['--max-line-length', maxlength]
        if maxdoclenght:
            args += ['--max-doc-length', maxdoclenght]
        if maxcomplexity:
            args += ['--max-complexity', maxcomplexity]
        if showsource:
            args += ['--show-source']
        if statistics:
            args += ['--statistics']
        args += [str(path)]
        app = application.Application()
        prelim_opts, remaining_args = app.parse_preliminary_options(args)
>       cfg, cfg_dir = config.load_config(
            config=prelim_opts.config,
            extra=prelim_opts.append_config,
            isolated=prelim_opts.isolated,
        )
E       AttributeError: module 'flake8.options.config' has no attribute 'load_config'

environment:

pytest-flake8==1.1.3 flake8==4.0.1

It appears flake8 introduced this config item in v5.0 and the project spec is allowing flake8>=4.0.

jaraco commented 4 months ago

This did not occur with v1.1.1.

I'm surprised there's any regression here. I'd aimed for there to be very little behavioral change in v1.1.2. Here's the diff: https://github.com/coherent-oss/pytest-flake8/compare/1.1.1...v1.1.2. 1.1.1 also allowed flake8 >= 4.

I see now that v1.1.3 introduce the change (https://github.com/coherent-oss/pytest-flake8/compare/v1.1.2...v1.1.3), with 472da173c3d42c33b3a623f6b3b67b6808f14bec being the relevant commit. There's no mention of that in the changelog. I'll get the changelog updated and bump the minimum version.