Skip to content

Commit a895011

Browse files
Create unit test to test metadata parser
1 parent a0f8726 commit a895011

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

scripts/tests/py/test_metadata.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import unittest
2+
from metadata import Metadata
3+
from metadata import Metadata_Reader
4+
5+
6+
class TestMetadataReader(unittest.TestCase):
7+
# build the test Metadata_Reader object
8+
#defines expected arguments associated with runs
9+
def setUp(self):
10+
11+
# build the reader object
12+
self.reader=Metadata_Reader("/src/python_testing", "/scripts/tests/py/env.yaml")
13+
self.actual_runs_metadata = self.reader.get_runs_metadata()
14+
self.expected_runs_metadata = {}
15+
16+
self.expected_runs_metadata["/src/python_testing/TC_RR_1_1.py+run1"] = Metadata(app="out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app",
17+
discriminator=1234, py_script_path="/src/python_testing/TC_RR_1_1.py", run="run1", passcode=20202021)
18+
19+
# gets the metadata associated with each run by parsing the test script and compares it to the expected metadata values
20+
def test_case1(self):
21+
for actual_run in self.actual_runs_metadata:
22+
self.assertEqual(self.actual_runs_metadata[actual_run], self.expected_runs_metadata[actual_run])
23+
24+
25+
if __name__=="__main__":
26+
unittest.main()
27+

0 commit comments

Comments
 (0)