From d50118bfcb3895e1501084c577bfd697bc246ce5 Mon Sep 17 00:00:00 2001 From: Jannes van den Bogert Date: Wed, 26 Jun 2024 14:44:52 +0200 Subject: [PATCH] Fix the hardcoded path --- tests/test_dispatch_request.py | 9 ++------- tests/test_get_send_file_max_age.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/test_dispatch_request.py b/tests/test_dispatch_request.py index a374664d..f94f67f4 100644 --- a/tests/test_dispatch_request.py +++ b/tests/test_dispatch_request.py @@ -2,8 +2,6 @@ import pytest from flask import Flask, json from werkzeug.exceptions import HTTPException, NotFound, InternalServerError from unittest.mock import patch - -# Import the module where branch_coverage and track_coverage are defined from flask import branch_coverage, track_coverage def create_app(): @@ -54,11 +52,8 @@ def test_not_found_handling(client): def test_no_route(client): response = client.get('/no_route') assert response.status_code == 404 - # Revised or removed based on actual coverage tracking setup - # assert branch_coverage.get('dispatch_request_no_route_found', False) -# Test to save branch coverage data into a JSON file after all tests -def test_save_branch_coverage(): - file_path = '/Users/jannesvandenbogert/Documents/GitHub/flask/coverage_result.json' + +def save_coverage_to_json(file_path='coverage_result.json'): with open(file_path, 'w') as json_file: json.dump(branch_coverage, json_file, indent=4) \ No newline at end of file diff --git a/tests/test_get_send_file_max_age.py b/tests/test_get_send_file_max_age.py index 4f0d4378..3f2fea0a 100644 --- a/tests/test_get_send_file_max_age.py +++ b/tests/test_get_send_file_max_age.py @@ -6,7 +6,7 @@ from flask.app import Flask as FlaskApp from flask import branch_coverage, track_coverage import json -def save_coverage_to_json(file_path='/Users/jannesvandenbogert/Documents/GitHub/flask/coverage_result.json'): +def save_coverage_to_json(file_path='coverage_result.json'): with open(file_path, 'w') as json_file: json.dump(branch_coverage, json_file, indent=4)