summaryrefslogtreecommitdiff
path: root/run_tests.py
blob: c8db26375706f66919592881fc8e055d5f0712bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
"""
Testing with pytest
=================

This test runner uses pytest for test discovery and running. It uses the argument
spec of pytest, but with some options pre-set. To begin with, make sure you have
pytest installed, e.g.:

    $ pip install pytest

To run the tests, use:

    $ ./run_tests.py

For more details check <https://rdflib.readthedocs.io/en/stable/developers.html>.

Coverage
========

If ``pytest-cov`` is placed in $PYTHONPATH, it can be used to create coverage
information if the "--cov" option is supplied.

See <https://github.com/pytest-dev/pytest-cov> for details.

"""

import json
import sys

if __name__ == "__main__":
    try:
        import pytest
    except ImportError:
        print(
            """\
    Requires pytest. Try:

        $ pip install pytest

    Exiting. """,
            file=sys.stderr,
        )
        exit(1)

    finalArgs = sys.argv[1:]
    print("Running pytest with:", json.dumps(finalArgs))
    sys.exit(pytest.main(args=finalArgs))