Skip to content

Commit 0550565

Browse files
committed
chore: fixup unit test paths
1 parent 1d03447 commit 0550565

4 files changed

Lines changed: 40 additions & 7 deletions

File tree

.github/workflows/runTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#------------------------------------------------------------------------------
33
# Run all tests
44
#------------------------------------------------------------------------------
5-
name: Unit Tests
5+
name: Manual Unit Tests
66

77
on:
88
workflow_dispatch:

.github/workflows/tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Unit Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
tests:
9+
name: tests
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python 3.x
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install requirements
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r ./requirements/local.txt
24+
25+
- name: secure_logger Unit tests
26+
run: |
27+
export PYTHONPATH=$PYTHONPATH:$(pwd)
28+
python -m unittest discover -s secure_logger/tests/
29+
30+
- name: setup.py tests
31+
run: |
32+
export PYTHONPATH=$PYTHONPATH:$(pwd)
33+
python -m unittest setup_test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ report:
3838
cloc . --exclude-ext=svg,json,zip --vcs=git
3939

4040
test:
41-
cd secure_logger && python -m unittest tests/tests.py
41+
python -m unittest discover -s secure_logger/tests/ && \
4242
python -m setup_test
4343

4444
build:

secure_logger/tests/tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def test_decorator_output(self):
113113

114114
# noqa: C0301
115115
expected_output = (
116-
"INFO:secure_logger.decorators:secure_logger: tests.tests.mock_decorated_def() "
117-
"['<tests.tests.TestModuleDefDecorator testMethod=test_decorator_output>', " + hello_world
116+
"INFO:secure_logger.decorators:secure_logger: tests.mock_decorated_def() "
117+
"['<tests.TestModuleDefDecorator testMethod=test_decorator_output>', " + hello_world
118118
)
119119
with self.assertLogs(level=logging.DEBUG) as cm:
120120
self.mock_decorated_def("hello world")
@@ -147,8 +147,8 @@ def decorator_with_custom_params(self, test_dict, test_list):
147147
def test_class_method_with_default_params(self):
148148
"""Test class method with default parameters."""
149149
expected_output = (
150-
"INFO:secure_logger.decorators:secure_logger: tests.tests.decorator_with_defaults() "
151-
"['<tests.tests.TestClassMethodDecorator.MockClass"
150+
"INFO:secure_logger.decorators:secure_logger: tests.decorator_with_defaults() "
151+
"['<tests.TestClassMethodDecorator.MockClass"
152152
)
153153

154154
with self.assertLogs(level=logging.DEBUG) as cm:
@@ -167,7 +167,7 @@ def test_class_with_default_params(self):
167167
class MockDecoratedClass:
168168
"""Test 3: decorate a class."""
169169

170-
expected_output = "INFO:secure_logger.decorators:secure_logger: tests.tests.MockDecoratedClass. "
170+
expected_output = "INFO:secure_logger.decorators:secure_logger: tests.MockDecoratedClass. "
171171

172172
with self.assertLogs(level=logging.DEBUG) as cm:
173173
MockDecoratedClass()

0 commit comments

Comments
 (0)