@@ -121,7 +121,11 @@ def run_stubtest(
121
121
with contextlib .redirect_stdout (output ):
122
122
test_stubs (parse_options ([TEST_MODULE_NAME ] + options ), use_builtins_fixtures = True )
123
123
# remove cwd as it's not available from outside
124
- return output .getvalue ().replace (tmp_dir + os .sep , "" )
124
+ return (
125
+ output .getvalue ()
126
+ .replace (os .path .realpath (tmp_dir ) + os .sep , "" )
127
+ .replace (tmp_dir + os .sep , "" )
128
+ )
125
129
126
130
127
131
class Case :
@@ -1279,7 +1283,8 @@ def test_output(self) -> None:
1279
1283
expected = (
1280
1284
f'error: { TEST_MODULE_NAME } .bad is inconsistent, stub argument "number" differs '
1281
1285
'from runtime argument "num"\n '
1282
- "Stub: at line 1\n def (number: builtins.int, text: builtins.str)\n "
1286
+ f"Stub: at line 1 in file { TEST_MODULE_NAME } .pyi\n "
1287
+ "def (number: builtins.int, text: builtins.str)\n "
1283
1288
f"Runtime: at line 1 in file { TEST_MODULE_NAME } .py\n def (num, text)\n \n "
1284
1289
"Found 1 error (checked 1 module)\n "
1285
1290
)
@@ -1437,7 +1442,7 @@ def test_config_file(self) -> None:
1437
1442
output = run_stubtest (stub = stub , runtime = runtime , options = [])
1438
1443
assert remove_color_code (output ) == (
1439
1444
f"error: { TEST_MODULE_NAME } .temp variable differs from runtime type Literal[5]\n "
1440
- "Stub: at line 2\n _decimal.Decimal\n Runtime:\n 5\n \n "
1445
+ f "Stub: at line 2 in file { TEST_MODULE_NAME } .pyi \n _decimal.Decimal\n Runtime:\n 5\n \n "
1441
1446
"Found 1 error (checked 1 module)\n "
1442
1447
)
1443
1448
output = run_stubtest (stub = stub , runtime = runtime , options = [], config_file = config_file )
0 commit comments