From 30cf68a804690e19433ad1c0db7caf2aaa053311 Mon Sep 17 00:00:00 2001 From: "Daniel W. Anner" Date: Wed, 19 Jul 2023 11:04:51 -0400 Subject: [PATCH] Update definitions_test.py --- tests/definitions_test.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/definitions_test.py b/tests/definitions_test.py index 48f1796e7..118732c6f 100644 --- a/tests/definitions_test.py +++ b/tests/definitions_test.py @@ -38,13 +38,14 @@ def _get_definition_files(): def _get_diff_from_upstream(): file_list = [] - temp_dir = tempfile.TemporaryDirectory() - upstream_repo = Repo.clone_from(url=NETBOX_DT_LIBRARY_URL, to_path=temp_dir.name) + repo = Repo(f"{os.path.dirname(os.path.abspath(__file__))}/../") - # repo = Repo(f"{os.path.dirname(os.path.abspath(__file__))}/../") - upstream = upstream_repo.remotes.origin + if "upstream" not in repo.remotes: + repo.create_remote("upstream", NETBOX_DT_LIBRARY_URL) + + upstream = repo.remotes.upstream upstream.fetch() - changes = upstream_repo.head.commit.diff(upstream.refs["master"].object.hexsha) + changes = repo.head.commit.diff(upstream.refs["master"].object.hexsha) for path, schema in SCHEMAS: # Initialize the schema