Skip to content

Commit c28e1ba

Browse files
committed
Add pytest skipif for installation tests in github actions
1 parent ba0cd76 commit c28e1ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_tools.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
VENV_TEST = ROOT / '.venv_test'
1414
PACKAGE_NAME = 'stat-log-db'
1515

16+
GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true"
17+
1618
#endregion
1719

1820

@@ -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)