@@ -1346,6 +1346,51 @@ def test_cache_default_literal_file(tmp_path: Path, factor: str) -> None:
1346
1346
assert "completed success" in stderr
1347
1347
assert error_code == 0
1348
1348
1349
+ @pytest .mark .parametrize ("factor" , test_factors )
1350
+ def test_cache_environment_variable (tmp_path : Path , factor : str ) -> None :
1351
+ """Ensure that changing the environment variables will result in different cache keys"""
1352
+ test_file = "cache_environment_tool.cwl"
1353
+ test_job_file = "cache_environment.yml"
1354
+ cache_dir = str (tmp_path / "cwltool_cache" )
1355
+ commands = factor .split ()
1356
+ commands .extend (
1357
+ [
1358
+ "--cachedir" ,
1359
+ cache_dir ,
1360
+ "--outdir" ,
1361
+ str (tmp_path / "outdir" ),
1362
+ get_data ("tests/" + test_file ),
1363
+ get_data (f"tests/{ test_job_file } " )
1364
+ ]
1365
+ )
1366
+ error_code , _ , stderr = get_main_output (commands )
1367
+
1368
+ stderr = re .sub (r"\s\s+" , " " , stderr )
1369
+ assert "Output of job will be cached in" in stderr
1370
+ assert error_code == 0 , stderr
1371
+
1372
+ error_code , _ , stderr = get_main_output (commands )
1373
+ assert "Output of job will be cached in" not in stderr
1374
+ assert error_code == 0 , stderr
1375
+
1376
+ commands = factor .split ()
1377
+ test_job_file = "cache_environment2.yml"
1378
+ commands .extend (
1379
+ [
1380
+ "--cachedir" ,
1381
+ cache_dir ,
1382
+ "--outdir" ,
1383
+ str (tmp_path / "outdir" ),
1384
+ get_data ("tests/" + test_file ),
1385
+ get_data (f"tests/{ test_job_file } " )
1386
+ ]
1387
+ )
1388
+
1389
+ error_code , _ , stderr = get_main_output (commands )
1390
+
1391
+ stderr = re .sub (r"\s\s+" , " " , stderr )
1392
+ assert "Output of job will be cached in" in stderr
1393
+ assert error_code == 0 , stderr
1349
1394
1350
1395
def test_write_summary (tmp_path : Path ) -> None :
1351
1396
"""Test --write-summary."""
0 commit comments