Skip to content

Commit ff76b6b

Browse files
authored
Remove comment between xfail and test function. (#952)
In python 3.13, when a comment is placed between `xfail` and a type checked test function, it causes `inspect.get_source` to return the decorator, comment, function signature, but no body.
1 parent 77064ef commit ff76b6b

2 files changed

Lines changed: 18 additions & 30 deletions

File tree

gel/_internal/_testbase/_models.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,6 @@
8989
TNAME_PY = "tname__"
9090

9191

92-
MYPY_INI = """\
93-
[mypy]
94-
strict = True
95-
ignore_errors = False
96-
follow_imports = normal
97-
show_error_codes = True
98-
local_partial_types = True
99-
100-
# This is very intentional as it allows us to type check things
101-
# that must be flagged as an error by the type checker.
102-
# Don't "type: ignore" unless it's part of the test.
103-
warn_unused_ignores = True
104-
"""
105-
106-
10792
def _get_test_class_dir(cls: type[unittest.TestCase]) -> pathlib.Path:
10893
test_file = sys.modules[cls.__module__].__file__
10994
if test_file is None:

tests/test_model_generator.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3982,8 +3982,9 @@ def test_modelgen_save_reload_links_01(self):
39823982
assert fresh.user is not None
39833983
self.assertEqual(fresh.user.id, alice.id)
39843984

3985-
@tb.xfail
3986-
# See XXX comments
3985+
@tb.xfail('''
3986+
See XXX comments
3987+
''')
39873988
def test_modelgen_save_reload_links_02(self):
39883989
from models.orm import default
39893990

@@ -5190,16 +5191,17 @@ def test_modelgen_linkprops_05(self):
51905191
self.assertEqual(gs0_link.__linkprops__.is_tall_enough, True)
51915192
self.assertEqual(gs1_link.__linkprops__.is_tall_enough, False)
51925193

5193-
@tb.xfail
5194-
# victor: merge doesn't happen
5195-
# yury: this is probably OK -- we decided that the Gel server should
5196-
# "merge things". When a ProxyModel is assigned to a single link
5197-
# or added to a link set, it should just replace the existing one
5198-
# there. Whatever __linkprops__ are coming in after the assignment
5199-
# will be sent to Gel in save() / sync() -- they both are only saving
5200-
# the __gel_changed_fields__.
5201-
# I'm keeping the test here, but I think we'll remove it later
5202-
# once we discuss this one more time.
5194+
@tb.xfail('''
5195+
victor: merge doesn't happen
5196+
yury: this is probably OK -- we decided that the Gel server should
5197+
"merge things". When a ProxyModel is assigned to a single link
5198+
or added to a link set, it should just replace the existing one
5199+
there. Whatever __linkprops__ are coming in after the assignment
5200+
will be sent to Gel in save() / sync() -- they both are only
5201+
saving the __gel_changed_fields__.
5202+
I'm keeping the test here, but I think we'll remove it later
5203+
once we discuss this one more time.
5204+
''')
52035205
def test_modelgen_linkprops_06(self):
52045206
from models.orm import default
52055207

@@ -5244,9 +5246,10 @@ def test_modelgen_linkprops_07(self):
52445246
self.assertEqual(member.__linkprops__.rank, None)
52455247
self.assertEqual(member.__linkprops__.role, "sorceress")
52465248

5247-
@tb.xfail
5248-
# victor: merge doesn't happen
5249-
# yury: read the comment in test_modelgen_linkprops_06
5249+
@tb.xfail('''
5250+
victor: merge doesn't happen
5251+
yury: read the comment in test_modelgen_linkprops_06
5252+
''')
52505253
def test_modelgen_linkprops_08(self):
52515254
from models.orm import default
52525255

0 commit comments

Comments
 (0)