[New-bugs-announce] [issue46416] Direct invocation of `Lib/test/test_typing.py` fails

Nikita Sobolev report at bugs.python.org
Mon Jan 17 10:22:26 EST 2022


New submission from Nikita Sobolev <mail at sobolevn.me>:

Here's the problem:

```
» ./python.exe Lib/test/test_typing.py
........................................................................................................................................................................................................s.....................................................................................................................F.........................................................................................
======================================================================
FAIL: test_special_attrs2 (__main__.SpecialAttrsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_typing.py", line 5068, in test_special_attrs2
    self.assertEqual(
    ^^^^^^^^^^^^^^^^^
AssertionError: '__main__' != 'test.test_typing'
- __main__
+ test.test_typing
```

I think it is a good idea to use the same hack we have in `test_enum.py`: https://github.com/python/cpython/blob/83d544b9292870eb44f6fca37df0aa351c4ef83a/Lib/test/test_enum.py#L34

```python
MODULE = ('test.test_typing', '__main__')[__name__=='__main__']
```

PR is on its way :)

----------
components: Tests
messages: 410800
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Direct invocation of `Lib/test/test_typing.py` fails
type: behavior
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46416>
_______________________________________


More information about the New-bugs-announce mailing list