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

8.1.0: test_dump_version_flake8 fails with D100 Missing docstring in public module #1045

Open
mtelka opened this issue May 7, 2024 · 1 comment

Comments

@mtelka
Copy link

mtelka commented May 7, 2024

The test_dump_version_flake8 test fails with this error:

=================================== FAILURES ===================================
___________________________ test_dump_version_flake8 ___________________________

tmp_path = PosixPath('/tmp/pytest-of-marcel/pytest-28/test_dump_version_flake80')

    def test_dump_version_flake8(tmp_path: Path) -> None:
        flake8 = shutil.which("flake8")
        if flake8 is None:
            pytest.skip("flake8 not found")
        dump_a_version(tmp_path)
>       subprocess.run([flake8, "VERSION.py"], cwd=tmp_path, check=True)

testing/test_functions.py:153:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

input = None, capture_output = False, timeout = None, check = True
popenargs = (['/usr/bin/flake8', 'VERSION.py'],)
kwargs = {'cwd': PosixPath('/tmp/pytest-of-marcel/pytest-28/test_dump_version_flake80')}
process = <Popen: returncode: 1 args: ['/usr/bin/flake8', 'VERSION.py']>
stdout = None, 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/flake8', 'VERSION.py']' returned non-zero exit status 1.

/usr/lib/python3.9/subprocess.py:528: CalledProcessError
----------------------------- Captured stdout call -----------------------------
VERSION.py:1:1: D100 Missing docstring in public module
------------------------------ Captured log call -------------------------------
DEBUG    setuptools_scm.version:version.py:98 tag 1.2.3
DEBUG    setuptools_scm.version:version.py:61 '1.2.3' re.compile('^(?:[\\w-]+-)?(?P<version>[vV]?\\d+(?:\\.\\d+){0,2}[^\\+]*)(?:\\+.*)?$') <re.Match object; span=(0, 5), match='1.2.3'>
DEBUG    setuptools_scm.version:version.py:62 key 1 data {'version': '1.2.3'}, ('1.2.3',), '1.2.3'
DEBUG    setuptools_scm.version:version.py:71 tag '1.2.3' parsed to {'version': '1.2.3', 'prefix': '', 'suffix': ''}
DEBUG    setuptools_scm.version:version.py:106 version pre parse 1.2.3
DEBUG    setuptools_scm.version:version.py:112 version=<Version('1.2.3')>
INFO     setuptools_scm.version:version.py:218 version 1.2.3 -> 1.2.3
DEBUG    setuptools_scm.dump_version:dump_version.py:83 dump 1.2.3 into /tmp/pytest-of-marcel/pytest-28/test_dump_version_flake80/VERSION.py
=========================== short test summary info ============================
FAILED testing/test_functions.py::test_dump_version_flake8 - subprocess.Calle...
======= 1 failed, 256 passed, 7 skipped, 1 xfailed in 283.08s (0:04:43) ========

This is the flake8 version information:

$ /usr/bin/flake8 --version
7.0.0 (flake8-2020: 1.8.1, flake8-bugbear: 24.4.26, flake8-docstrings: 1.7.0, flake8-noqa: 1.4.0, flake8-typing-imports: 1.15.0, mccabe: 0.7.0, pycodestyle: 2.11.1, pyflakes: 3.2.0, teamcity-messages: 1.32) CPython 3.9.19 on SunOS
$
@RonnyPfannschmidt
Copy link
Contributor

Indeed, the test sloppy expects no Plugins for flake8

That particular one should resolve by adding a reasonable docstring to the template

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