Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:
python-version: '3.9'
- os: macos-latest
python-version: '3.10'
include:
- os: macos-13
python-version: '3.9'
- os: macos-13
python-version: '3.10'
steps:
- uses: actions/checkout@v6
with:
Expand Down
11 changes: 8 additions & 3 deletions boilerplates/git_repo_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import pathlib
import tempfile
import typing as t
import unittest

import git
Expand All @@ -13,8 +14,8 @@
class GitRepoTests(unittest.TestCase):
"""Provide several utility properties and methods named repo_* and git_*."""

repo = None # type: git.Repo
repo_path = None # type: pathlib.Path
repo: t.Optional[git.Repo] = None
repo_path: t.Optional[pathlib.Path] = None

def setUp(self):
self._tmpdir = tempfile.TemporaryDirectory() # pylint: disable = consider-using-with
Expand All @@ -36,12 +37,13 @@ def tearDown(self):

@property
def repo_head_hexsha(self) -> str:
self.assertIsInstance(self.repo, git.Repo)
assert isinstance(self.repo, git.Repo), type(self.repo)
return self.repo.head.commit.hexsha[:8]

def git_init(self) -> git.Repo:
"""Initialize a git repository in the temporary folder."""
self.repo = git.Repo.init(str(self.repo_path))
self.assertIsInstance(self.repo, git.Repo)
self.repo.git.config('user.email', 'you@example.com')
self.repo.git.config('user.name', 'Your Name')
return self.repo
Expand All @@ -59,6 +61,8 @@ def git_commit_new_file(self) -> pathlib.Path:
with tempfile.NamedTemporaryFile('w', dir=str(self.repo_path), delete=False) as repo_file:
repo_file.write('spam spam lovely spam\n')
path = pathlib.Path(repo_file.name)
self.assertIsInstance(self.repo, git.Repo)
assert isinstance(self.repo, git.Repo), type(self.repo)
self.repo.index.add([path.name])
self.repo.index.commit(f'created file {path}')
_LOG.debug('commited file %s as %s', path, self.repo_head_hexsha)
Expand All @@ -68,6 +72,7 @@ def git_commit_new_file(self) -> pathlib.Path:
def git_modify_file(self, path: pathlib.Path, add: bool = False, commit: bool = False) -> None:
"""Modify an existing file."""
self.assertIsInstance(self.repo, git.Repo)
assert isinstance(self.repo, git.Repo), type(self.repo)
self.assertIsInstance(path, pathlib.Path)
self.assertTrue(path.is_file())
with path.open('a') as repo_file:
Expand Down
5 changes: 3 additions & 2 deletions boilerplates/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class Package:
install_requires: t.Optional[t.List[str]] = None
"""If None, determined using requirements.txt."""

extras_require: t.Mapping[str, t.List[str]] = {}
extras_require: t.Dict[str, t.List[str]] = {}
"""A dictionary containing entries of type 'some_feature': ['requirement1', 'requirement2']."""

python_requires: t.Optional[str] = None
Expand Down Expand Up @@ -383,6 +383,7 @@ def setup(cls) -> None:
packages=cls.packages, package_dir={'': cls.root_directory},
include_package_data=True,
package_data=cls.package_data, exclude_package_data=cls.exclude_package_data,
install_requires=cls.install_requires, extras_require=cls.extras_require,
install_requires=[] if cls.install_requires is None else cls.install_requires,
extras_require=cls.extras_require,
python_requires=cls.python_requires,
entry_points=cls.entry_points)
3 changes: 2 additions & 1 deletion requirements_ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ boilerplates[setup] ~= 1.2
codecov ~= 2.1
coverage ~= 7.2
flake518 ~= 1.6
mypy ~= 1.5
mypy ~= 1.19; python_version < '3.10'
mypy ~= 2.1; python_version >= '3.10'
pydocstyle ~= 6.3
pylint ~= 3.3; python_version < '3.10'
pylint ~= 4.0; python_version >= '3.10'
Expand Down
Loading