Debian Codegraph @

debian/run_test_in_testdir

raw
1 #!/bin/bash
2
3 # Run build-time tests in build-time testdir,
4 # to avoid test output files appear in the build_dir
5 # (which is installed to the debian package)
6 #
7 # build_dir is provided as an argument to this script.
8 # No action is taken if it is not provided
9
10 build_dir=$1
11
12 if [ "x$build_dir" != "x" ]; then
13
14 # monkeypatch suggested at https://stackoverflow.com/a/62055409/12401525
15
16 cat >$build_dir/conftest.py << END
17 import pytest
18 @pytest.fixture(autouse=True)
19 def change_test_dir(request, monkeypatch):
20 monkeypatch.chdir(request.fspath.dirname)
21 END
22
23 fi