Skip to content

Commit 91848a0

Browse files
committed
Test Tweaks
- Replace `_` with `-` in `test_tools.py` `PACKAGE_NAME` - Add `.venv_test` to `.gitignore` - Add pytest `skipif` for `tools.sh` installation tests in Github Actions environment(s)
1 parent 40f551f commit 91848a0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ celerybeat.pid
138138
.env
139139
.envrc
140140
.venv
141+
.venv_test
141142
env/
142143
venv/
143144
ENV/

tests/test_tools.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
ROOT = Path(__file__).resolve().parent.parent
1212
SCRIPT = ROOT / 'tools.sh'
1313
VENV_TEST = ROOT / '.venv_test'
14-
PACKAGE_NAME = 'stat_log_db'
14+
PACKAGE_NAME = 'stat-log-db'
15+
16+
GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true"
1517

1618
#endregion
1719

@@ -82,13 +84,15 @@ def test_help():
8284
except AssertionError:
8385
assert out.strip() == readme_content.strip(), "Help output does not match README content (leading & trailing whitespace stripped)"
8486

87+
@pytest.mark.skipif(GITHUB_ACTIONS, reason="Skipping test on GitHub Actions")
8588
def test_install_dev(test_venv):
8689
code, out = run_tools(['-id'], use_test_venv=True)
8790
assert code == 0
8891
assert 'Installing' in out
8992
assert 'dev' in out
9093
assert is_installed(PACKAGE_NAME), 'Package should be installed after dev install'
9194

95+
@pytest.mark.skipif(GITHUB_ACTIONS, reason="Skipping test on GitHub Actions")
9296
def test_install_normal(test_venv):
9397
code, out = run_tools(['-in'], use_test_venv=True)
9498
assert code == 0
@@ -102,6 +106,7 @@ def test_install_invalid_arg(test_venv):
102106
assert ('Unsupported argument' in out) or ('Invalid install mode' in out)
103107
assert not is_installed(PACKAGE_NAME), 'Package should not be installed after invalid install argument'
104108

109+
@pytest.mark.skipif(GITHUB_ACTIONS, reason="Skipping test on GitHub Actions")
105110
def test_uninstall(test_venv):
106111
# Ensure something installed first (dev mode)
107112
icode, iout = run_tools(['-id'], use_test_venv=True)
@@ -113,6 +118,7 @@ def test_uninstall(test_venv):
113118
assert 'Uninstall complete' in uout
114119
assert not is_installed(PACKAGE_NAME), 'Package should not be installed after uninstall'
115120

121+
@pytest.mark.skipif(GITHUB_ACTIONS, reason="Skipping test on GitHub Actions")
116122
def test_install_and_clean_multi_flag(test_venv):
117123
code, out = run_tools(['-id', '-c'], use_test_venv=True)
118124
assert code == 0
@@ -135,6 +141,7 @@ def test_test_invalid_arg():
135141
assert code == 1
136142
assert ('Unsupported argument' in out) or ('Invalid test mode' in out)
137143

144+
@pytest.mark.skipif(GITHUB_ACTIONS, reason="Skipping test on GitHub Actions")
138145
def test_clean():
139146
code, out = run_tools(['-c'])
140147
assert code == 0

0 commit comments

Comments
 (0)