Closed jdebacker closed 5 months ago
Running pytest returns:
pytest
(base) jason.debacker@JDEBACKER-8 PSL-Core % pytest ============================= test session starts ============================== platform darwin -- Python 3.11.5, pytest-7.4.0, pluggy-1.0.0 rootdir: /Users/jason.debacker/repos/PSL-Core plugins: anyio-3.5.0, requests-mock-1.11.0 collected 5 items Tools/Catalog-Builder/catalog_builder/tests/test_catalog.py .F..F [100%] =================================== FAILURES =================================== _____________________________ test_catalog_schema ______________________________ cb = <catalog_builder.catalog.CatalogBuilder object at 0x107e57e90> def test_catalog_schema(cb): exp_keys = set(["source", "value"]) for project in cb.catalog: for _, item in cb.catalog[project].items(): > assert set(item.keys()) == exp_keys E AttributeError: 'str' object has no attribute 'keys' Tools/Catalog-Builder/catalog_builder/tests/test_catalog.py:96: AttributeError ___________________________ test_catalog_one_project ___________________________ cb = <catalog_builder.catalog.CatalogBuilder object at 0x107e55c50> def test_catalog_one_project(cb): projects = [ {"org": "noorg", "repo": "TestProject", "branch": "master"}, {"org": "someorg", "repo": "NewProject", "branch": "master"} ] > cb = catalog.CatalogBuilder( projects, build_one="NewProject", ) Tools/Catalog-Builder/catalog_builder/tests/test_catalog.py:112: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <catalog_builder.catalog.CatalogBuilder object at 0x1071ff950> projects = [{'branch': 'master', 'org': 'noorg', 'repo': 'TestProject'}, {'branch': 'master', 'org': 'someorg', 'repo': 'NewProject'}] index_dir = None, card_dir = None, develop = False, build_one = 'NewProject' incubating = False def __init__( self, projects=None, index_dir=None, card_dir=None, develop=False, build_one=None, incubating=False ): self.incubating = incubating if projects is None: if self.incubating: folder = "../../../Incubating" else: folder = "../../../Catalog" p = os.path.join(self.CURRENT_PATH, f"{folder}/register.json") with open(p, "r") as f: self.projects = json.loads(f.read()) else: self.projects = projects > self.index_dir = index_dir or os.path.join(self.CURRENT_PATH, folder) E UnboundLocalError: cannot access local variable 'folder' where it is not associated with a value Tools/Catalog-Builder/catalog_builder/catalog.py:87: UnboundLocalError =========================== short test summary info ============================ FAILED Tools/Catalog-Builder/catalog_builder/tests/test_catalog.py::test_catalog_schema - AttributeError: 'str' object has no attribute 'keys' FAILED Tools/Catalog-Builder/catalog_builder/tests/test_catalog.py::test_catalog_one_project - UnboundLocalError: cannot access local variable 'folder' where it is not as... ========================= 2 failed, 3 passed in 0.44s ==========================
Resolved with PR #320
Running
pytest
returns: