[NFC][infra][build] Move test data to test_data directory. (#6081)
Do this for consistency.
diff --git a/infra/build/functions/request_build_test.py b/infra/build/functions/request_build_test.py
index 4dc8cc9..50e8eec 100644
--- a/infra/build/functions/request_build_test.py
+++ b/infra/build/functions/request_build_test.py
@@ -63,10 +63,11 @@
' - x86_64\n')
image_project = 'oss-fuzz'
base_images_project = 'oss-fuzz-base'
- testcase_path = os.path.join(os.path.dirname(__file__),
- 'expected_build_steps.json')
- with open(testcase_path) as testcase_file:
- expected_build_steps = json.load(testcase_file)
+ expected_build_steps_file_path = test_utils.get_test_data_file_path(
+ 'expected_build_steps.json')
+
+ with open(expected_build_steps_file_path) as expected_build_steps_file:
+ expected_build_steps = json.load(expected_build_steps_file)
with ndb.Client().context():
Project(name='test-project',
diff --git a/infra/build/functions/request_coverage_build_test.py b/infra/build/functions/request_coverage_build_test.py
index 1327e36..8333dcf 100644
--- a/infra/build/functions/request_coverage_build_test.py
+++ b/infra/build/functions/request_coverage_build_test.py
@@ -65,10 +65,11 @@
dockerfile_contents = 'test line'
image_project = 'oss-fuzz'
base_images_project = 'oss-fuzz-base'
- testcase_path = os.path.join(os.path.dirname(__file__),
- 'expected_coverage_build_steps.json')
- with open(testcase_path) as testcase_file:
- expected_coverage_build_steps = json.load(testcase_file)
+
+ expected_build_steps_file_path = test_utils.get_test_data_file_path(
+ 'expected_coverage_build_steps.json')
+ with open(expected_build_steps_file_path) as expected_build_steps_file:
+ expected_coverage_build_steps = json.load(expected_build_steps_file)
with ndb.Client().context():
Project(name='test-project',
diff --git a/infra/build/functions/expected_build_steps.json b/infra/build/functions/test_data/expected_build_steps.json
similarity index 100%
rename from infra/build/functions/expected_build_steps.json
rename to infra/build/functions/test_data/expected_build_steps.json
diff --git a/infra/build/functions/expected_coverage_build_steps.json b/infra/build/functions/test_data/expected_coverage_build_steps.json
similarity index 100%
rename from infra/build/functions/expected_coverage_build_steps.json
rename to infra/build/functions/test_data/expected_coverage_build_steps.json
diff --git a/infra/build/functions/test_utils.py b/infra/build/functions/test_utils.py
index 9aac8ea..8e19d57 100644
--- a/infra/build/functions/test_utils.py
+++ b/infra/build/functions/test_utils.py
@@ -102,3 +102,8 @@
os.environ['DATASTORE_DATASET'] = TEST_PROJECT_ID
os.environ['GCP_PROJECT'] = TEST_PROJECT_ID
os.environ['FUNCTION_REGION'] = 'us-central1'
+
+
+def get_test_data_file_path(filename):
+ """Returns the path to a test data file with name |filename|."""
+ return os.path.join(os.path.dirname(__file__), 'test_data', filename)