77
88
99def test_expansion ():
10- template_with_dotenv = Path (__file__ ).parent / "template_with_dotenv.yaml"
11- template_no_dotenv = Path (__file__ ).parent / "template_no_dotenv.yaml"
10+ cronos_has_dotenv = Path (__file__ ).parent / "cronos_has_dotenv.yaml"
11+ cronos_no_dotenv = Path (__file__ ).parent / "cronos_no_dotenv.yaml"
12+ cronos_has_posix_no_dotenv = (
13+ Path (__file__ ).parent / "cronos_has_posix_no_dotenv.yaml"
14+ )
1215
1316 # `expand_yaml` is backward compatible, not expanded, and no diff
14- assert yaml .safe_load (open (template_no_dotenv )) == expand_yaml (
15- template_no_dotenv , None
16- )
17+ assert yaml .safe_load (open (cronos_no_dotenv )) == expand_yaml (cronos_no_dotenv , None )
1718
1819 # `expand_yaml` is expanded but no diff
1920 assert not DeepDiff (
20- yaml .safe_load (open (template_no_dotenv )),
21- expand_yaml (template_with_dotenv , None ),
21+ yaml .safe_load (open (cronos_no_dotenv )),
22+ expand_yaml (cronos_has_dotenv , None ),
2223 ignore_order = True ,
2324 )
2425
2526 # overriding dotenv with relative path is expanded and has diff)
2627 assert DeepDiff (
27- yaml .safe_load (open (template_no_dotenv )),
28- expand_yaml (template_with_dotenv , ".env1" ),
28+ yaml .safe_load (open (cronos_no_dotenv )),
29+ expand_yaml (cronos_has_dotenv , ".env1" ),
2930 ignore_order = True ,
3031 ) == {
3132 "values_changed" : {
@@ -40,8 +41,8 @@ def test_expansion():
4041
4142 # overriding dotenv with absolute path is expanded and has diff
4243 assert DeepDiff (
43- yaml .safe_load (open (template_no_dotenv )),
44- expand_yaml (template_with_dotenv , os .path .abspath ("test_expansion/.env1" )),
44+ yaml .safe_load (open (cronos_no_dotenv )),
45+ expand_yaml (cronos_has_dotenv , os .path .abspath ("test_expansion/.env1" )),
4546 ignore_order = True ,
4647 ) == {
4748 "values_changed" : {
@@ -53,3 +54,19 @@ def test_expansion():
5354 }
5455 }
5556 }
57+
58+ # overriding dotenv with absolute path is expanded and no diff
59+ # If the `.env` changes, it may impact the test result
60+ assert not DeepDiff (
61+ yaml .safe_load (open (cronos_no_dotenv )),
62+ expand_yaml (cronos_has_posix_no_dotenv , os .path .abspath ("../scripts/.env" )),
63+ ignore_order = True ,
64+ )
65+
66+ # overriding dotenv with absolute path is expanded and no diff
67+ # If the `.env` changes, it may impact the test result
68+ assert not DeepDiff (
69+ yaml .safe_load (open (cronos_no_dotenv )),
70+ expand_yaml (cronos_has_dotenv , os .path .abspath ("../scripts/.env" )),
71+ ignore_order = True ,
72+ )
0 commit comments