Skip to content

Commit 57aa4f1

Browse files
committed
Add unit tests
1 parent 011250f commit 57aa4f1

File tree

7 files changed

+98
-0
lines changed

7 files changed

+98
-0
lines changed

.coveragerc

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# .coveragerc to control coverage.py
2+
[run]
3+
source = ./
4+
parallel = True
5+
concurrency = multiprocessing,thread
6+
7+
[report]
8+
# Regexes for lines to exclude from consideration
9+
exclude_lines =
10+
# Have to re-enable the standard pragma
11+
pragma: no cover
12+
13+
# Don't complain about missing debug-only code:
14+
def __repr__
15+
if self\.debug
16+
17+
# Don't complain if tests don't hit defensive assertion code:
18+
raise AssertionError
19+
raise NotImplementedError
20+
raise CoverageWarning
21+
22+
# Don't complain if non-runnable code isn't run:
23+
if 0:
24+
if __name__ == .__main__.:
25+
def __main__\(\):
26+
27+
omit:
28+
./tests/*
29+
setup.py
30+
dependencies.py
31+
main.py

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ qgate_graph/__pycache__/
99
/build/
1010
/.idea/
1111
.idea/misc.xml
12+
/.idea/
13+
/.coverage

cover.bat

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rem Setting based on 'https://coverage.readthedocs.io/en/7.3.2/'
2+
3+
coverage erase
4+
coverage run -m unittest discover
5+
coverage combine
6+
coverage report -m
7+
coverage-badge -f -o coverage.svg

coverage.svg

+21
Loading

dev-requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
click~=8.1
22
matplotlib>=3.5
3+
coverage>=7
4+
coverage-badge>=1
5+

tests/__init__.py

Whitespace-only changes.

tests/test_basic.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
import unittest
3+
import logging
4+
import time
5+
from os import path
6+
import shutil
7+
from qgate_graph.graph_performance import GraphPerformance
8+
from qgate_graph.graph_executor import GraphExecutor
9+
10+
class TestCaseBasic(unittest.TestCase):
11+
12+
OUTPUT_ADR = "../output/test_basic/"
13+
@classmethod
14+
def setUpClass(cls):
15+
shutil.rmtree(TestCaseBasic.OUTPUT_ADR, True)
16+
17+
@classmethod
18+
def tearDownClass(cls):
19+
pass
20+
21+
def test_basic(self):
22+
"""Generate graphs based in input data."""
23+
logging.basicConfig()
24+
logging.getLogger().setLevel(logging.INFO)
25+
26+
graph = GraphPerformance()
27+
graph.generate_from_dir("../input", "../output")
28+
graph.generate_from_file("../input/prf_cassandra_02.txt", "../output")
29+
30+
graph = GraphExecutor()
31+
graph.generate_from_dir("../input", "../output")
32+
graph.generate_from_file("../input/prf_cassandra_02.txt", "../output")
33+
34+
# graph.generate_from_file("input/prf_nonprod_BDP_NoSQL.txt", output)

0 commit comments

Comments
 (0)