Skip to content

Commit 6edb9a0

Browse files
committed
Skip tests until we can use GCS on Github Actions.
[#2780]
1 parent 7134bda commit 6edb9a0

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

jobs/gtfs-rt-parser-v2/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def pytest_addoption(parser):
2+
parser.addoption(
3+
"--gcs",
4+
action="store_true",
5+
default=False,
6+
help="Run tests requiring GCS",
7+
)

jobs/gtfs-rt-parser-v2/gtfs_rt_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def validate_and_upload(
413413
with open(results_path) as f:
414414
records = json.load(f)
415415
except FileNotFoundError as e:
416-
# TODO: does this mean no errors?
416+
# This exception was previously generating the error "[Errno 2] No such file or directory"
417417
msg = f"WARNING: no validation output file found in {results_path} for {extract.path}"
418418
if verbose:
419419
log(

jobs/gtfs-rt-parser-v2/test_gtfs_rt_parser.py renamed to jobs/gtfs-rt-parser-v2/tests/test_gtfs_rt_parser.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,26 @@ def test_rt_file_processing_outcome_construction() -> None:
5252
)
5353

5454

55+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
5556
def test_vehicle_positions():
56-
base64url = "aHR0cHM6Ly9tdnNodXR0bGUucmlkZXN5c3RlbXMubmV0L3N1YnNjcmlwdGlvbnMvZ3Rmc3J0L3ZlaGljbGVzLmFzaHg="
5757
result = runner.invoke(
5858
app,
59-
["parse", "vehicle_positions", "2024-10-22T18:00:00", "--base64url", base64url],
59+
["parse", "vehicle_positions", "1999-10-22T18:00:00"],
6060
catch_exceptions=False,
6161
)
6262
assert result.exit_code == 0
6363
assert (
64-
"test-calitp-gtfs-rt-raw-v2/vehicle_positions/dt=2024-10-22/hour=2024-10-22T18:00:00+00:00"
64+
"test-calitp-gtfs-rt-raw-v2/vehicle_positions/dt=1999-10-22/hour=1999-10-22T18:00:00+00:00"
6565
in result.stdout
6666
)
67-
assert "4786 vehicle_positions files in 139 aggregations" in result.stdout
67+
assert "1 vehicle_positions files in 1 aggregations" in result.stdout
6868

69-
assert f"url filter applied, only processing {base64url}" in result.stdout
70-
assert "writing 28 lines" in result.stdout
69+
assert "writing 1 lines" in result.stdout
7170
assert "test-calitp-gtfs-rt-parsed" in result.stdout
72-
assert "saving 40 outcomes" in result.stdout
71+
assert "saving 1 outcomes" in result.stdout
7372

7473

74+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
7575
def test_no_vehicle_positions_for_date():
7676
base64url = (
7777
"aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L3ZlaGljbGVwb3NpdGlvbnM_YWdlbmN5PVNJ"
@@ -87,6 +87,7 @@ def test_no_vehicle_positions_for_date():
8787
assert "outcomes" not in result.stdout
8888

8989

90+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
9091
def test_no_vehicle_positions_for_url():
9192
result = runner.invoke(
9293
app,
@@ -99,6 +100,7 @@ def test_no_vehicle_positions_for_url():
99100
assert "outcomes" not in result.stdout
100101

101102

103+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
102104
def test_no_records_for_url_vehicle_positions_on_date():
103105
base64url = (
104106
"aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L3ZlaGljbGVwb3NpdGlvbnM_YWdlbmN5PVNJ"
@@ -115,6 +117,7 @@ def test_no_records_for_url_vehicle_positions_on_date():
115117
assert "saving 38 outcomes" in result.stdout
116118

117119

120+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
118121
def test_trip_updates():
119122
base64url = "aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L3RyaXB1cGRhdGVzP2FnZW5jeT1TQQ=="
120123
result = runner.invoke(
@@ -135,6 +138,7 @@ def test_trip_updates():
135138
assert "saving 49 outcomes" in result.stdout
136139

137140

141+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
138142
def test_service_alerts():
139143
base64url = "aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L3NlcnZpY2VhbGVydHM_YWdlbmN5PUFN"
140144
result = runner.invoke(
@@ -155,6 +159,7 @@ def test_service_alerts():
155159
assert "saving 30 outcomes" in result.stdout
156160

157161

162+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
158163
def test_validation():
159164
base64url = "aHR0cHM6Ly9hcGkuZ29zd2lmdC5seS9yZWFsLXRpbWUvbWVuZG9jaW5vL2d0ZnMtcnQtdHJpcC11cGRhdGVz"
160165
result = runner.invoke(
@@ -175,6 +180,7 @@ def test_validation():
175180
assert "saving 30 outcomes" in result.stdout
176181

177182

183+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
178184
def test_no_recent_schedule_for_vehicle_positions_on_validation():
179185
base64url = (
180186
"aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L3ZlaGljbGVwb3NpdGlvbnM_YWdlbmN5PVNJ"
@@ -202,8 +208,8 @@ def test_no_recent_schedule_for_vehicle_positions_on_validation():
202208
assert "saving 38 outcomes" in result.stdout
203209

204210

211+
@pytest.mark.skipif("not config.getoption('--gcs')", reason="requires GCS credentials")
205212
def test_no_output_file_for_vehicle_positions_on_validation():
206-
# "WARNING: no validation output file found" generates the log "[Errno 2] No such file or directory"
207213
result = runner.invoke(
208214
app,
209215
[
@@ -216,12 +222,14 @@ def test_no_output_file_for_vehicle_positions_on_validation():
216222
],
217223
catch_exceptions=True,
218224
)
225+
print(result.stdout)
219226
assert result.exit_code == 0
220227
assert (
221228
"test-calitp-gtfs-rt-raw-v2/vehicle_positions/dt=2024-10-17/hour=2024-10-17T00:00:00+00:00"
222229
in result.stdout
223230
)
224231
assert "5487 vehicle_positions files in 139 aggregations" in result.stdout
225232
assert "limit of 3 feeds was set" in result.stdout
233+
# "WARNING: no validation output file found" was previously generating the error "[Errno 2] No such file or directory"
226234
assert "WARNING: no validation output file found" in result.stdout
227235
assert "saving 122 outcomes" in result.stdout

0 commit comments

Comments
 (0)