فهرست منبع

Merge branch 'develop' into feature/#681-remove-obsolate-files

Đỗ Trường Giang 1 سال پیش
والد
کامیت
8892d686bb
2فایلهای تغییر یافته به همراه13 افزوده شده و 2 حذف شده
  1. 5 0
      tests/rest/conftest.py
  2. 8 2
      tests/rest/test_end_to_end.py

+ 5 - 0
tests/rest/conftest.py

@@ -318,3 +318,8 @@ def cleanup_files(reset_configuration_singleton, inject_core_sections):
         shutil.rmtree(".data", ignore_errors=True)
     if os.path.exists(".my_data"):
         shutil.rmtree(".my_data", ignore_errors=True)
+
+    yield
+    for path in [".data", ".my_data", "user_data", ".taipy"]:
+        if os.path.exists(path):
+            shutil.rmtree(path, ignore_errors=True)

+ 8 - 2
tests/rest/test_end_to_end.py

@@ -20,7 +20,10 @@ def create_and_submit_scenario(config_id: str, client) -> Dict:
     assert response.status_code == 201
 
     scenario = response.json.get("scenario")
-    assert (set(scenario) - set(json.load(open("tests/rest/json/expected/scenario.json")))) == set()
+    path = "tests/rest/json/expected/scenario.json"
+    with open(path) as file:
+        expected_scenario = json.load(file)
+    assert (set(scenario) - set(expected_scenario)) == set()
 
     response = client.post(url_for("api.scenario_submit", scenario_id=scenario.get("id")))
     assert response.status_code == 200
@@ -32,7 +35,10 @@ def get(url, name, client) -> Dict:
     response = client.get(url)
     returned_data = response.json.get(name)
 
-    assert (set(returned_data) - set(json.load(open(f"tests/rest/json/expected/{name}.json")))) == set()
+    path = f"tests/rest/json/expected/{name}.json"
+    with open(path) as file:
+        expected_data = json.load(file)
+    assert (set(returned_data) - set(expected_data)) == set()
 
     return returned_data