Skip to content

Commit 22e31dc

Browse files
authored
Use test_ prefix only for actual unit test files to allow the usage of Pytest (#81)
* Use test_ prefix only for actual unit test files New developers and some test frameworks (e.g. pytest) search for files named 'test_*.py' or '*_test.py' to discover test cases. However currently the naming may be confusing as the files named 'test_*.py' contain code to be executed by the unittests not the actual unittest itself. This also leads to errors in e.g. the Python VSCode extension which autodiscovers tests using the above naming scheme, This renames all test_ files removing the prefix or adding bm_ as the prefix for benchmark helpers together with a more descriptive name. The main test entrypoint is now test_scorep.py. No code changes (except where files were referenced) are done. * Introduce cases folder for files run by the unit tests
1 parent 84b0ac7 commit 22e31dc

24 files changed

Lines changed: 32 additions & 32 deletions

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ jobs:
5353
run: pip install .
5454
- name: Run tests
5555
working-directory: test
56-
run: ./test.py
56+
run: ./test_scorep.py

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ install:
2020
- pip install mpi4py numpy
2121

2222
script:
23-
- pip install ./ && cd test && python test.py
23+
- pip install ./ && cd test && python test_scorep.py

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ add_custom_target(ScorepModule ALL
2626

2727
enable_testing()
2828
add_test(NAME ScorepPythonTests
29-
COMMAND Python::Interpreter test.py
29+
COMMAND Python::Interpreter test_scorep.py
3030
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/test
3131
)
3232
set(pythonPath ${CMAKE_CURRENT_BINARY_DIR}/site-packages)

DEVELOPING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Although, we do not actively maintain the CMake build system, and will not help
2222

2323
You might find this build system helpful for development, especially if you are doing C/C++ things:
2424
* Include paths for C++ are correctly searched for and set up for use by IDEs or other tools. For example Visual Studio Code works out of the box, given the appropriate extensions (C++, Python, CMake) are installed.
25-
* A folder `site-packages` is created in the build folder where the C/C++ extension module and the scorep module are copied to on each build (e.g. `make`-call). Hence it is possible to add that folder to the PYTHONPATH environment variable, build the project and start debugging or execute the tests in test/test.py.
25+
* A folder `site-packages` is created in the build folder where the C/C++ extension module and the scorep module are copied to on each build (e.g. `make`-call). Hence it is possible to add that folder to the PYTHONPATH environment variable, build the project and start debugging or execute the tests in test/test_scorep.py.
2626
* A `test` target exists which can be run to execute all tests.
2727

2828
Please note, that changes to the Python source files are not reflected in the build folder unless a build is executed.

benchmark/benchmark.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import pickle
88

99
bench = benchmark_helper.BenchmarkEnv(repetitions=51)
10-
tests = ["test_1.py", "test_2.py"]
10+
tests = ["bm_baseline.py", "bm_simplefunc.py"]
1111
results = {}
1212

1313
reps_x = {}
14-
reps_x["test_1.py"] = ["1000000", "2000000", "3000000", "4000000", "5000000"]
15-
reps_x["test_2.py"] = ["100000", "200000", "300000", "400000", "500000"]
14+
reps_x["bm_baseline.py"] = ["1000000", "2000000", "3000000", "4000000", "5000000"]
15+
reps_x["bm_simplefunc.py"] = ["100000", "200000", "300000", "400000", "500000"]
1616

1717
for test in tests:
1818
results[test] = {"profile": {}, "trace": {}, "dummy": {}, "None": {}}

0 commit comments

Comments
 (0)