pytest-dev / pytest

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
https://pytest.org
MIT License
12.08k stars 2.68k forks source link

filename contains more than one dot #6422

Closed cocobear closed 4 years ago

cocobear commented 4 years ago

filename contains more than one dot, for example a file named : 2.foo.py can not be used in pytest

 ~/code/LeetCode-in-Python/solutions/0001.two-sum    master   pytest 1.two-sum.py =============================================== test session starts =============================================== platform darwin -- Python 3.7.5, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 rootdir: /Users/cocobear/code/LeetCode-in-Python, inifile: pytest.ini collected 0 items / 1 error

===================================================== ERRORS ====================================================== __ ERROR collecting solutions/0001.two-sum/1.two-sum.py ___ ImportError while importing test module '/Users/cocobear/code/LeetCode-in-Python/solutions/0001.two-sum/1.two-sum.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: ModuleNotFoundError: No module named '1'

Package Version


aiohttp 3.6.2 alabaster 0.7.12 astroid 2.3.3 async-timeout 3.0.1 attrs 19.1.0 Babel 2.7.0 certifi 2018.11.29 chardet 3.0.4 click 6.7 colorama 0.4.1 cos-python-sdk-v5 1.7.7 coscmd 1.8.6.10 DateTime 4.3 dicttoxml 1.7.4 docopt 0.6.2 docutils 0.15.2 feedparser 5.2.1 gevent 1.4.0 gitsome 0.8.4 greenlet 0.4.15 idna 2.8 imagesize 1.1.0 importlib-metadata 1.3.0 isort 4.3.21 Jinja2 2.10.1 kaptan 0.5.12 lazy-object-proxy 1.4.3 libtmux 0.8.2 MarkupSafe 1.1.1 mccabe 0.6.1 memory-profiler 0.55.0 more-itertools 8.0.2 msgpack 0.6.1 multidict 4.5.2 numpydoc 0.9.1 packaging 19.1 pip 19.3.1 pipenv 2018.11.26 pluggy 0.13.1 ply 3.11 powerline-status 2.7 prettytable 0.7.2 prompt-toolkit 2.0.9 psutil 5.6.7 py 1.8.1 Pygments 2.4.2 pylint 2.4.4 pynvim 0.4.0 pyparsing 2.4.2 pytest 5.3.2 pytz 2019.3 PyYAML 5.1.2 requests 2.22.0 Send2Trash 1.5.0 setuptools 41.6.0 six 1.12.0 snowballstemmer 1.9.0 Sphinx 2.1.2 sphinxcontrib-applehelp 1.0.1 sphinxcontrib-devhelp 1.0.1 sphinxcontrib-htmlhelp 1.0.2 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.2 sphinxcontrib-serializinghtml 1.1.3 tmuxp 1.5.3 tqdm 4.41.1 typed-ast 1.4.0 uritemplate 3.0.0 uritemplate.py 3.0.2 urllib3 1.25.3 virtualenv 16.4.0 virtualenv-clone 0.5.1 wcwidth 0.1.7 websockets 8.1 wheel 0.33.6 wrapt 1.11.1 yarl 1.3.0 zipp 0.6.0 zope.interface 4.7.1

RonnyPfannschmidt commented 4 years ago

using invalid module names is not supported