Skip to content

Commit

Permalink
Update test script and add coverage configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
tyutyutyu committed Mar 2, 2024
1 parent d309006 commit 0e6d095
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 13 deletions.
13 changes: 2 additions & 11 deletions .scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,5 @@

set -e

docker build \
--file .docker/Dockerfile.tests \
--quiet \
--tag tyutyutyu/msps_test \
.

docker run \
--interactive \
--rm \
--tty \
tyutyutyu/msps_test
poetry run coverage run --branch -m pytest
coverage report --show-missing
66 changes: 65 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ packages = [{ include = "msps", from = "src" }, { include = "tests" }]
python = ">=3.10"
rich = "^13.7.0"
typer = "^0.9.0"
coverage = "^7.4.3"

[tool.poetry.group.test.dependencies]
pytest = "^8.0.0"
Expand All @@ -39,3 +40,6 @@ strict = true

[tool.pytest.ini_options]
pythonpath = ["src"]

[tool.coverage.run]
source = ["src/msps"]
5 changes: 4 additions & 1 deletion tests/test_maven.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
from msps.maven import Maven


HOME = os.environ["HOME"]


class TestMaven(unittest.TestCase):
@mock.patch.dict(os.environ, {"M2_HOME": "/custom/path"})
def test_M2_HOME1(self) -> None:
self.assertEqual(Maven().m2_home, "/custom/path")

def test_M2_HOME2(self) -> None:
self.assertEqual(Maven().m2_home, "/home/app/.m2")
self.assertEqual(Maven().m2_home, f"{HOME}/.m2")

0 comments on commit 0e6d095

Please sign in to comment.