File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [pytest]
2+ markers =
3+ last: run marked tests after all others
Original file line number Diff line number Diff line change 4343 pytest-cov
4444test =
4545 pytest>=7.2
46+ pytest-ordering
4647
4748[options.packages.find]
4849where = src
Original file line number Diff line number Diff line change @@ -20,19 +20,24 @@ def test_formatters_are_unique(self):
2020 BaseDateFormat .__subclasses__ ()
2121 ), "Formatter names have to be unique."
2222
23- # TODO: order tests, so this test is run last; otherwise formatter names won't be unique
24- # class ISO8601DateFormat2(BaseDateFormat):
25- # # NOTE: do we care about validation? could use regex
26- # # but maybe be permissive, warn if invalid but we can parse
27-
28- # name = "ISO8601"
29-
30- # assert len(BaseDateFormat.available_formatters()) != len(BaseDateFormat.__subclasses__())
31-
3223 def test_parse_not_implemented (self ):
3324 with pytest .raises (NotImplementedError ):
3425 BaseDateFormat ().parse ("foo bar baz" )
3526
3627 def test_parse_to_string (self ):
3728 with pytest .raises (NotImplementedError ):
3829 BaseDateFormat ().to_string (1991 )
30+
31+
32+ @pytest .mark .last
33+ def test_formatters_unique_error ():
34+ # confirm that our uniqe formatters check fails when it should
35+
36+ # run this test last because we can't undefine the subclass
37+ # once it exists...
38+ class ISO8601DateFormat2 (BaseDateFormat ):
39+ name = "ISO8601" # duplicates existing formatter
40+
41+ assert len (BaseDateFormat .available_formatters ()) != len (
42+ BaseDateFormat .__subclasses__ ()
43+ )
You can’t perform that action at this time.
0 commit comments