Skip to content

Commit

Permalink
Merge pull request #328 from jacebrowning/test-all-python
Browse files Browse the repository at this point in the history
Test all supported versions of Python
  • Loading branch information
jacebrowning authored Apr 27, 2024
2 parents de769db + 78b9f9c commit 85c59c0
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

runs-on: ${{ matrix.os }}

Expand Down
142 changes: 29 additions & 113 deletions .pylint.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,91 +51,43 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=
print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
raw-checker-failed,
bad-inline-option,
locally-disabled,
locally-enabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
missing-docstring,
fixme,
global-statement,
invalid-name,
missing-docstring,
redefined-outer-name,
too-few-public-methods,
fixme,
too-many-locals,
too-many-arguments,
unnecessary-pass,
broad-except,
duplicate-code,
too-many-branches,
keyword-arg-before-vararg,
redefined-builtin,
too-many-return-statements,
too-many-public-methods,
bad-continuation,
no-member,
not-an-iterable,
too-many-ancestors,
too-many-instance-attributes,
too-many-statements,
attribute-defined-outside-init,
unsupported-assignment-operation,
unsupported-delete-operation,
too-many-nested-blocks,
protected-access,
not-an-iterable,
no-member,
assigning-non-slot,
line-too-long,
unsubscriptable-object,
too-many-instance-attributes,
singleton-comparison,
subprocess-run-check,
too-many-lines,
line-too-long,
too-many-locals,
too-many-statements,
unnecessary-dunder-call,
redefined-builtin,
consider-using-f-string,
consider-iterating-dictionary,
use-maxsplit-arg,
use-implicit-booleaness-not-comparison,
keyword-arg-before-vararg,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -177,46 +129,28 @@ max-nested-blocks=5

[BASIC]

# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata

# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]+$

# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$

# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1

# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

Expand All @@ -226,21 +160,12 @@ good-names=i,j,k,ex,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no

# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$

# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

Expand All @@ -256,9 +181,6 @@ no-docstring-rgx=^_
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty

# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

Expand All @@ -284,12 +206,6 @@ max-line-length=88
# Maximum number of lines in a module
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down
16 changes: 8 additions & 8 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
altgraph==0.17.2 ; python_version >= "3.8" and python_version < "4.0"
astroid==2.4.2 ; python_version >= "3.8" and python_version < "4.0"
astroid==2.13.5 ; python_version >= "3.8" and python_version < "4.0"
astunparse==1.6.3 ; python_version >= "3.8" and python_version < "3.9"
black==22.8.0 ; python_version >= "3.8" and python_version < "4.0"
cached-property==1.5.2 ; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -10,8 +10,9 @@ click==8.1.3 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.5 ; python_version >= "3.8" and python_version < "4.0"
coverage==6.4.4 ; python_version >= "3.8" and python_version < "4.0"
coverage[toml]==6.4.4 ; python_version >= "3.8" and python_version < "4.0"
coveragespace==6.0 ; python_version >= "3.8" and python_version < "4.0"
coveragespace==6.1 ; python_version >= "3.8" and python_version < "4.0"
datafiles==2.1.2 ; python_version >= "3.8" and python_version < "4.0"
dill==0.3.8 ; python_version >= "3.8" and python_version < "4.0"
docopt==0.6.2 ; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.1.1 ; python_version >= "3.8" and python_version < "3.11"
freezegun==1.2.2 ; python_version >= "3.8" and python_version < "4.0"
Expand Down Expand Up @@ -42,20 +43,20 @@ parse==1.19.0 ; python_version >= "3.8" and python_version < "4.0"
pathspec==0.10.1 ; python_version >= "3.8" and python_version < "4.0"
pefile==2022.5.30 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32"
platformdirs==2.5.2 ; python_version >= "3.8" and python_version < "4.0"
pluggy==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
pluggy==1.5.0 ; python_version >= "3.8" and python_version < "4.0"
pydocstyle==6.1.1 ; python_version >= "3.8" and python_version < "4.0"
pygments==2.15.0 ; python_version >= "3.8" and python_version < "4.0"
pyinstaller-hooks-contrib==2022.10 ; python_version >= "3.8" and python_version < "4.0"
pyinstaller==4.5.1 ; python_version >= "3.8" and python_version < "4.0"
pylint==2.6.2 ; python_version >= "3.8" and python_version < "4.0"
pylint==2.15.10 ; python_version >= "3.8" and python_version < "4.0"
pymdown-extensions==10.0 ; python_version >= "3.8" and python_version < "4.0"
pync==2.0.3 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "darwin"
pyparsing==3.0.9 ; python_version >= "3.8" and python_version < "4.0"
pytest-cov==4.1.0 ; python_version >= "3.8" and python_version < "4.0"
pytest-describe==2.0.1 ; python_version >= "3.8" and python_version < "4.0"
pytest-cov==5.0.0 ; python_version >= "3.8" and python_version < "4.0"
pytest-describe==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
pytest-expecter==3.0 ; python_version >= "3.8" and python_version < "4.0"
pytest-random==0.02 ; python_version >= "3.8" and python_version < "4.0"
pytest==7.3.1 ; python_version >= "3.8" and python_version < "4.0"
pytest==8.1.2 ; python_version >= "3.8" and python_version < "4.0"
python-dateutil==2.8.2 ; python_version >= "3.8" and python_version < "4.0"
python-termstyle==0.1.10 ; python_version >= "3.8" and python_version < "4.0"
pytkdocs==0.16.1 ; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -70,7 +71,6 @@ setuptools==66.1.1 ; python_version >= "3.8" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.8" and python_version < "4.0"
sniffer==0.4.1 ; python_version >= "3.8" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
toml==0.10.2 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_full_version < "3.11.0a7"
tomlkit==0.10.2 ; python_version >= "3.8" and python_version < "4.0"
types-freezegun==1.1.10 ; python_version >= "3.8" and python_version < "4.0"
Expand Down
8 changes: 6 additions & 2 deletions gitman/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ def clone(
git("-C", normpath, "remote", "add", "-f", "origin", sparse_paths_repo)

with open(
"%s/%s/.git/info/sparse-checkout" % (os.getcwd(), normpath), "w"
"%s/%s/.git/info/sparse-checkout" % (os.getcwd(), normpath),
"w",
encoding="utf-8",
) as fd:
fd.write("\n".join(sparse_paths))
with open(
"%s/%s/.git/objects/info/alternates" % (os.getcwd(), normpath), "w"
"%s/%s/.git/objects/info/alternates" % (os.getcwd(), normpath),
"w",
encoding="utf-8",
) as fd:
fd.write("%s/objects" % sparse_paths_repo)

Expand Down
2 changes: 1 addition & 1 deletion gitman/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def get_dependencies(
def log(self, message: str = "", *args):
"""Append a message to the log file."""
os.makedirs(self.location_path, exist_ok=True)
with open(self.log_path, "a") as outfile:
with open(self.log_path, "a", encoding="utf-8") as outfile:
outfile.write(message.format(*args) + "\n")

def _get_sources(self, *, use_locked: Optional[bool] = None) -> List[Source]:
Expand Down
18 changes: 10 additions & 8 deletions gitman/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ def call(name, *args, _show=True, _stream=True, _shell=False, _ignore=False):
else:
env.pop(lp_key, None) # last resort: remove the env var

command = subprocess.Popen( # pylint: disable=subprocess-run-check
name if _shell else [name, *args],
encoding="utf-8",
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=_shell,
env=env,
command = (
subprocess.Popen( # pylint: disable=subprocess-run-check,consider-using-with
name if _shell else [name, *args],
encoding="utf-8",
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=_shell,
env=env,
)
)

# Poll process.stdout to show stdout live
Expand Down
2 changes: 1 addition & 1 deletion gitman/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=no-self-use,unused-variable,expression-not-assigned
# pylint: disable=unused-variable,expression-not-assigned

from unittest.mock import Mock, patch

Expand Down
2 changes: 0 additions & 2 deletions gitman/tests/test_git.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# pylint: disable=no-self-use

import os
from unittest.mock import Mock, patch

Expand Down
2 changes: 1 addition & 1 deletion gitman/tests/test_models_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=no-self-use,redefined-outer-name,unused-variable,expression-not-assigned,misplaced-comparison-constant,len-as-condition
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned,len-as-condition

import os

Expand Down
2 changes: 1 addition & 1 deletion gitman/tests/test_models_source.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=no-self-use,redefined-outer-name,misplaced-comparison-constant
# pylint: disable=redefined-outer-name

from copy import copy
from unittest.mock import Mock, patch
Expand Down
2 changes: 0 additions & 2 deletions gitman/tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# pylint: disable=no-self-use

from unittest.mock import call, patch

from gitman import plugin
Expand Down
2 changes: 1 addition & 1 deletion gitman/tests/test_shell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=no-self-use,misplaced-comparison-constant,expression-not-assigned
# pylint: disable=expression-not-assigned

import os
from unittest.mock import Mock, patch
Expand Down
Loading

0 comments on commit 85c59c0

Please sign in to comment.