Corey Morris
commited on
Commit
•
6ed8672
1
Parent(s):
25d217c
added a test and removed the code to only test a specific file because that code did not work
Browse files- .github/workflows/python-app.yml +1 -1
- test_paths.py +19 -0
.github/workflows/python-app.yml
CHANGED
@@ -37,4 +37,4 @@ jobs:
|
|
37 |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
38 |
- name: Test with pytest
|
39 |
run: |
|
40 |
-
pytest
|
|
|
37 |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
38 |
- name: Test with pytest
|
39 |
run: |
|
40 |
+
pytest
|
test_paths.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import unittest
|
2 |
+
import os
|
3 |
+
|
4 |
+
class TestPaths(unittest.TestCase):
|
5 |
+
def test_path_exists(self):
|
6 |
+
# test that the path results exists
|
7 |
+
self.assertTrue(os.path.exists('results'))
|
8 |
+
|
9 |
+
def test_results_directory_is_not_empty(self):
|
10 |
+
# test that the results directory is not empty
|
11 |
+
self.assertGreater(len(os.listdir('results')), 0)
|
12 |
+
|
13 |
+
def test_results_contain_json_files(self):
|
14 |
+
# test that the results director contains json files in the sub directores
|
15 |
+
# get a list of all the subdirectories
|
16 |
+
subdirectories = [x[0] for x in os.walk('results')]
|
17 |
+
# check if the subdirectories contain json files. only check one subdirectory
|
18 |
+
subdirectory = subdirectories[1]
|
19 |
+
self.assertGreater(len(os.listdir(subdirectory)), 0)
|