@@ -660,7 +660,6 @@ class Settings(BaseSettings):
660
660
"""
661
661
662
662
663
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
664
663
def test_env_file_config (env , tmp_path ):
665
664
p = tmp_path / '.env'
666
665
p .write_text (test_env_file )
@@ -691,7 +690,6 @@ class Settings(BaseSettings):
691
690
"""
692
691
693
692
694
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
695
693
def test_env_file_with_env_prefix (env , tmp_path ):
696
694
p = tmp_path / '.env'
697
695
p .write_text (prefix_test_env_file )
@@ -711,7 +709,6 @@ class Settings(BaseSettings):
711
709
assert s .c == 'best string'
712
710
713
711
714
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
715
712
def test_env_file_config_case_sensitive (tmp_path ):
716
713
p = tmp_path / '.env'
717
714
p .write_text (test_env_file )
@@ -735,7 +732,6 @@ class Settings(BaseSettings):
735
732
]
736
733
737
734
738
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
739
735
def test_env_file_export (env , tmp_path ):
740
736
p = tmp_path / '.env'
741
737
p .write_text (
@@ -761,7 +757,6 @@ class Settings(BaseSettings):
761
757
assert s .c == 'best string'
762
758
763
759
764
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
765
760
def test_env_file_export_validation_alias (env , tmp_path ):
766
761
p = tmp_path / '.env'
767
762
p .write_text ("""export a='{"b": ["1", "2"]}'""" )
@@ -775,7 +770,6 @@ class Settings(BaseSettings):
775
770
assert s .a == '2'
776
771
777
772
778
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
779
773
def test_env_file_config_custom_encoding (tmp_path ):
780
774
p = tmp_path / '.env'
781
775
p .write_text ('pika=p!±@' , encoding = 'latin-1' )
@@ -797,7 +791,6 @@ def home_tmp():
797
791
home_tmp_path .unlink ()
798
792
799
793
800
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
801
794
def test_env_file_home_directory (home_tmp ):
802
795
home_tmp_path , tmp_filename = home_tmp
803
796
home_tmp_path .write_text ('pika=baz' )
@@ -810,7 +803,6 @@ class Settings(BaseSettings):
810
803
assert Settings ().pika == 'baz'
811
804
812
805
813
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
814
806
def test_env_file_none (tmp_path ):
815
807
p = tmp_path / '.env'
816
808
p .write_text ('a' )
@@ -822,7 +814,6 @@ class Settings(BaseSettings):
822
814
assert s .a == 'xxx'
823
815
824
816
825
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
826
817
def test_env_file_override_file (tmp_path ):
827
818
p1 = tmp_path / '.env'
828
819
p1 .write_text (test_env_file )
@@ -838,7 +829,6 @@ class Settings(BaseSettings):
838
829
assert s .a == 'new string'
839
830
840
831
841
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
842
832
def test_env_file_override_none (tmp_path ):
843
833
p = tmp_path / '.env'
844
834
p .write_text (test_env_file )
@@ -852,7 +842,6 @@ class Settings(BaseSettings):
852
842
assert s .a is None
853
843
854
844
855
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
856
845
def test_env_file_not_a_file (env ):
857
846
class Settings (BaseSettings ):
858
847
a : str = None
@@ -862,7 +851,6 @@ class Settings(BaseSettings):
862
851
assert s .a == 'ignore non-file'
863
852
864
853
865
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
866
854
def test_read_env_file_cast_sensitive (tmp_path ):
867
855
p = tmp_path / '.env'
868
856
p .write_text ('a="test"\n B=123' )
@@ -871,15 +859,13 @@ def test_read_env_file_cast_sensitive(tmp_path):
871
859
assert read_env_file (p , case_sensitive = True ) == {'a' : 'test' , 'B' : '123' }
872
860
873
861
874
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
875
862
def test_read_env_file_syntax_wrong (tmp_path ):
876
863
p = tmp_path / '.env'
877
864
p .write_text ('NOT_AN_ASSIGNMENT' )
878
865
879
866
assert read_env_file (p , case_sensitive = True ) == {'NOT_AN_ASSIGNMENT' : None }
880
867
881
868
882
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
883
869
def test_env_file_example (tmp_path ):
884
870
p = tmp_path / '.env'
885
871
p .write_text (
@@ -907,7 +893,6 @@ class Settings(BaseSettings):
907
893
}
908
894
909
895
910
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
911
896
def test_env_file_custom_encoding (tmp_path ):
912
897
p = tmp_path / '.env'
913
898
p .write_text ('pika=p!±@' , encoding = 'latin-1' )
@@ -934,7 +919,6 @@ class Settings(BaseSettings):
934
919
"""
935
920
936
921
937
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
938
922
def test_multiple_env_file (tmp_path ):
939
923
base_env = tmp_path / '.env'
940
924
base_env .write_text (test_default_env_file )
@@ -954,7 +938,6 @@ class Settings(BaseSettings):
954
938
assert s .port == 8000
955
939
956
940
957
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
958
941
def test_model_env_file_override_model_config (tmp_path ):
959
942
base_env = tmp_path / '.env'
960
943
base_env .write_text (test_default_env_file )
@@ -974,7 +957,6 @@ class Settings(BaseSettings):
974
957
assert s .port == 8000
975
958
976
959
977
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
978
960
def test_multiple_env_file_encoding (tmp_path ):
979
961
base_env = tmp_path / '.env'
980
962
base_env .write_text ('pika=p!±@' , encoding = 'latin-1' )
@@ -988,7 +970,6 @@ class Settings(BaseSettings):
988
970
assert s .pika == 'chu!±@'
989
971
990
972
991
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
992
973
def test_read_dotenv_vars (tmp_path ):
993
974
base_env = tmp_path / '.env'
994
975
base_env .write_text (test_default_env_file )
@@ -1009,7 +990,6 @@ def test_read_dotenv_vars(tmp_path):
1009
990
}
1010
991
1011
992
1012
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
1013
993
def test_read_dotenv_vars_when_env_file_is_none ():
1014
994
assert (
1015
995
DotEnvSettingsSource (BaseSettings (), env_file = None , env_file_encoding = None )._read_env_files (
@@ -1211,7 +1191,6 @@ class Settings(BaseSettings):
1211
1191
Settings ()
1212
1192
1213
1193
1214
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
1215
1194
def test_secrets_dotenv_precedence (tmp_path ):
1216
1195
s = tmp_path / 'foo'
1217
1196
s .write_text ('foo_secret_value_str' )
@@ -1564,7 +1543,6 @@ class Settings(BaseSettings):
1564
1543
assert s .nested .SUB_sub .SUB_sub_SuB .val4 == 'v4'
1565
1544
1566
1545
1567
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
1568
1546
def test_dotenv_extra_allow (tmp_path ):
1569
1547
p = tmp_path / '.env'
1570
1548
p .write_text ('a=b\n x=y' )
@@ -1579,7 +1557,6 @@ class Settings(BaseSettings):
1579
1557
assert s .x == 'y'
1580
1558
1581
1559
1582
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
1583
1560
def test_dotenv_extra_forbid (tmp_path ):
1584
1561
p = tmp_path / '.env'
1585
1562
p .write_text ('a=b\n x=y' )
@@ -1596,7 +1573,6 @@ class Settings(BaseSettings):
1596
1573
]
1597
1574
1598
1575
1599
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
1600
1576
def test_dotenv_extra_case_insensitive (tmp_path ):
1601
1577
p = tmp_path / '.env'
1602
1578
p .write_text ('a=b' )
@@ -1610,7 +1586,6 @@ class Settings(BaseSettings):
1610
1586
assert s .A == 'b'
1611
1587
1612
1588
1613
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
1614
1589
def test_dotenv_extra_sub_model_case_insensitive (tmp_path ):
1615
1590
p = tmp_path / '.env'
1616
1591
p .write_text ('a=b\n SUB_model={"v": "v1"}' )
@@ -1803,7 +1778,6 @@ class Settings(BaseSettings):
1803
1778
assert s .x == '123'
1804
1779
1805
1780
1806
- @pytest .mark .skipif (not dotenv , reason = 'python-dotenv not installed' )
1807
1781
def test_dotenv_optional_json_field (tmp_path ):
1808
1782
p = tmp_path / '.env'
1809
1783
p .write_text ("""DATA='{"foo":"bar"}'""" )
0 commit comments