15
0
Files
python-flake8-pyi/set-tests-python-path.patch
Daniel Garcia 6e67e8b4c5 - Add set-tests-python-path.patch to fix tests inside osc build
environment, running the flake8 process with shell=True and forcing
  the PYTHONPATH.
- Update to 23.1.2:
  * Y011/Y014/Y015: Increase the maximum character length of literal
    numbers in default values from 7 to 10, allowing hexadecimal
    representation of 32-bit integers. Contributed by Avasam.
- 23.1.1
New error codes:
  * Y052: Disallow default values in global or class namespaces where
    the assignment does not have a type annotation. Stubs should be
    explicit about the type of all variables in the stub; without type
    annotations, the type checker is forced to make inferences, which
    may have unpredictable consequences. Enum members are excluded
    from this check, as are various special assignments such as
    __all__ and __match_args__.
Other changes:
  * Disallow numeric default values where len(str(default)) > 7. If a
    function has a default value where the string representation is
    greater than 7 characters, it is likely to be an implementation
    detail or a constant that varies depending on the system you're
    running on, such as sys.maxsize.
  * Disallow str or bytes defaults where the default is >50 characters
    long, for similar reasons.
  * Allow ast.Attribute nodes as default values for a small number of
    special cases, such as sys.maxsize and sys.executable.
  * Fewer Y020 false positives are now emitted when encountering
    default values in stub files.
- 23.1.0
Bugfixes:

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00

29 lines
1.2 KiB
Diff

Index: flake8_pyi-23.1.2/tests/test_pyi_files.py
===================================================================
--- flake8_pyi-23.1.2.orig/tests/test_pyi_files.py
+++ flake8_pyi-23.1.2/tests/test_pyi_files.py
@@ -35,16 +35,21 @@ def test_pyi_file(path: str) -> None:
message = line[match.end() : end_pos].strip()
expected_output += f"{path}:{lineno}: {match.group(1)}{message}\n"
+ pythonpath = os.environ.get("PYTHONPATH")
+ pythonpath = f"PYTHONPATH={pythonpath}:."
+
run_results = [
# Passing a file on command line
subprocess.run(
- ["flake8", "-j0", *flags, path],
+ " ".join([pythonpath, "flake8", "-j0", *flags, path]),
+ shell=True,
env={**os.environ, "PYTHONPATH": "."},
stdout=subprocess.PIPE,
),
# Passing "-" as the file, and reading from stdin instead
subprocess.run(
- ["flake8", "-j0", "--stdin-display-name", path, *flags, "-"],
+ " ".join([pythonpath, "flake8", "-j0", "--stdin-display-name", path, *flags, "-"]),
+ shell=True,
env={**os.environ, "PYTHONPATH": "."},
input=file_contents.encode("utf-8"),
stdout=subprocess.PIPE,