File: run_test.py

package info (click to toggle)
python-cai 1.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 43,276 kB
  • sloc: python: 713; makefile: 24
file content (62 lines) | stat: -rwxr-xr-x 1,445 bytes parent folder | download
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import pytest

# https://discuss.python.org/t/testing-doctests-breaks-src-layout/3728
# https://coverage.readthedocs.io/en/coverage-5.2.1/cmd.html


# pytest tests/test_module_seqrecord.py --cov=pydna --cov-append
# --cov-report=html --cov-report=xml --capture=no --durations=10
# --import-mode=importlib --nbval --current-env --doctest-modules
# --capture=no -vvv


def main():
    """docstring."""
    arg = sys.argv[-1] if len(sys.argv) > 1 else ""

    args = [
        f"src/{arg}",  # doctestdir
        "--cov=CAI",
        "--cov-append",
        "--cov-report=html",
        "--cov-report=xml",
        "--capture=no",
        "--durations=10",
        "--import-mode=importlib",
        "--nbval",
        "--current-env",
        "--doctest-modules",
        "--capture=no",
        "-vvv",
    ]

    result_suite_src = pytest.main(args)

    args = [
        f"tests/{arg}",  # test suite
        "--cov=CAI",
        "--cov-append",
        "--cov-report=html",
        "--cov-report=xml",
        "--capture=no",
        "--durations=10",
        "--import-mode=importlib",
        "--nbval",
        "--current-env",
        "--doctest-modules",
        "--capture=no",
        "-vvv",
    ]

    result_suite_tests = pytest.main(args)

    return result_suite_tests and result_suite_src


if __name__ == "__main__":
    result = main()
    sys.exit(int(result))