Skip to content

Commit

Permalink
Fix typing of tests and make pyright check them on CI. (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
devdanzin authored Sep 26, 2023
1 parent a0d70df commit 4663329
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
flit install --extras=all
- uses: jakebailey/pyright-action@v1
with:
working-directory: src
working-directory: .
2 changes: 1 addition & 1 deletion test/integration/test_archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_git_end_to_end(tmpdir):
and revisions[1].key not in commit2.name_rev
)

checkout = archiver.checkout(revisions[1], None)
checkout = archiver.checkout(revisions[1], {})

assert not (tmppath / "test.py").exists()

Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_build_with_config(tmpdir, cache_path):
[
"--debug",
"--config",
config_path,
str(config_path),
"--path",
tmpdir,
"--cache",
Expand Down
4 changes: 2 additions & 2 deletions test/integration/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_report_granular(builddir):
"cyclomatic.complexity",
"--message",
"-n",
1,
"1",
],
)
assert result.exit_code == 0, result.stdout
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_report_with_message_and_n(builddir):
runner = CliRunner()
result = runner.invoke(
main.cli,
["--path", builddir, "report", _path, "raw.multi", "--message", "-n", 1],
["--path", builddir, "report", _path, "raw.multi", "--message", "-n", "1"],
)
assert result.exit_code == 0, result.stdout
assert "basic test" not in result.stdout
Expand Down
4 changes: 3 additions & 1 deletion test/unit/test_archivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class MockRepo:
_is_dirty = False
commits = [MockCommit("commit-1"), MockCommit("commit-2")]
head = MockHead()
path: pathlib.Path
git: "MockGit"

def is_dirty(self):
return self._is_dirty
Expand Down Expand Up @@ -76,7 +78,7 @@ def repo(tmpdir):


def test_basearchiver():
wily.archivers.BaseArchiver(None)
wily.archivers.BaseArchiver(wily.config.DEFAULT_CONFIG)


def test_defaults():
Expand Down
5 changes: 3 additions & 2 deletions test/unit/test_build_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ def test_build_simple(config):
with patch("wily.state.resolve_archiver", return_value=MockArchiver), patch(
"wily.commands.build.resolve_operator", return_value=MockOperator
):
result = build.build(config, MockArchiver, _test_operators)
result = build.build(config, MockArchiver, _test_operators) # type: ignore
assert result is None


def test_run_operator(config):
name, data = build.run_operator(MockOperator, "123", config, ["test1.py"])
rev = Revision("123", None, None, 1, "message", [], [], [], [], [])
name, data = build.run_operator(MockOperator, rev, config, ["test1.py"])
assert name == "mock"
path = "C:\\home\\test1.py" if sys.platform == "win32" else "/home/test1.py"
assert data == {os.path.relpath(path, config.path): None}
6 changes: 3 additions & 3 deletions test/unit/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_store_basic(tmpdir):
key="12345",
author_name="Anthony Shaw",
author_email="[email protected]",
date="17/01/1990",
date=632545200,
message="my changes",
tracked_files=[target_path],
tracked_dirs=[target_path],
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_store_twice(tmpdir):
key="12345",
author_name="Anthony Shaw",
author_email="[email protected]",
date="17/01/1990",
date=632545200,
message="my changes",
tracked_files=[target_path],
tracked_dirs=[target_path],
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_store_relative_paths(tmpdir):
key="12345",
author_name="Anthony Shaw",
author_email="[email protected]",
date="17/01/1990",
date=632545200,
message="my changes",
tracked_files=[target_path],
tracked_dirs=[target_path],
Expand Down

0 comments on commit 4663329

Please sign in to comment.