Skip to content

Commit 29ac2b2

Browse files
committed
launching test subfolder for pytests
1 parent 26a05d6 commit 29ac2b2

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def get_extra_compile_args():
554554
]
555555

556556
def read_version():
557-
init_path = Path(__file__).parent / "yourpackage" / "__init__.py"
557+
init_path = Path(__file__).parent / "svv" / "__init__.py"
558558
src = init_path.read_text(encoding="utf-8")
559559
match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]+)[\'"]', src, re.M)
560560
if match:

svv/tests/__init__.py

Whitespace-only changes.

svv/tests/__main__.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
This file launches the testing suite for the svVascularize (svv)
3+
package. You can run the test suite with the following command:
4+
5+
`python -m svv.tests [pytest args]
6+
7+
The real test files are in the top-level ``tests/`` folder of the
8+
source code and not packaged within the distibution wheels. If you
9+
would like to run the tests, you will require the full repo.
10+
"""
11+
from __future__ import annotations
12+
import pathlib
13+
import sys
14+
import pytest
15+
16+
def main() -> None:
17+
# Locate the source package root wherever it is installed.
18+
root = pathlib.Path(__file__).resolve().parents[2]
19+
tests_dir = root / "tests"
20+
21+
if not tests_dir.is_dir():
22+
# This installation does not contain the tests suite
23+
# (probably because this is a wheel installation)
24+
print(
25+
" The full test-suite isn’t packaged in the installed wheel.\n"
26+
" Clone the repository if you want to run it:\n"
27+
" git clone https://github.com/SimVascular/svVascularize.git && cd svv && "
28+
"python -m svv.tests"
29+
)
30+
sys.exit(1)
31+
32+
sys.exit(pytest.main([str(tests_dir), *sys.argv[1:]]))
33+
34+
if __name__ == "__main__":
35+
main()

0 commit comments

Comments
 (0)