Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry run pytest raises SyntaxError: invalid escape sequence \S #465

Open
waketzheng opened this issue Jun 8, 2024 · 0 comments · May be fixed by #454
Open

poetry run pytest raises SyntaxError: invalid escape sequence \S #465

waketzheng opened this issue Jun 8, 2024 · 0 comments · May be fixed by #454
Assignees

Comments

@waketzheng
Copy link

Describe the Bug
Run unittest in local virtual environment that managed by poetry raises the following error:

(coveralls-py3.11) mac10.12 in ~/trying/coveralls-python on master ● λ poetry run pytest
====================================================== test session starts =======================================================
platform darwin -- Python 3.11.8, pytest-8.2.2, pluggy-1.5.0
rootdir: /Users/mac10.12/trying/coveralls-python
configfile: pyproject.toml
collected 59 items / 1 error

============================================================= ERRORS =============================================================
_______________________________________________ ERROR collecting tests/cli_test.py _______________________________________________
../../Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/lib/python3.11/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/lib/python3.11/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
/usr/local/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
../../Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/cli_test.py:8: in <module>
    import coveralls.cli
coveralls/cli.py:43: in <module>
    import docopt
E     File "/Users/mac10.12/Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/lib/python3.11/site-packages/docopt.py", line 165
E       name = re.findall('(<\S*?>)', source)[0]
E                         ^^^^^^^^^^
E   SyntaxError: invalid escape sequence '\S'
==================================================== short test summary info =====================================================
ERROR tests/cli_test.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================== 1 error in 1.62s ========================================================

To Reproduce

git clone [email protected]:TheKevJames/coveralls-python
cd coveralls-python
poetry install
poetry run pytest

Expected Behavior
Success to run poetry run pytest

Package Versions

  • pip list
Package            Version  Editable project location
------------------ -------- ---------------------------------------
certifi            2024.6.2
charset-normalizer 3.3.2
coverage           7.5.3
coveralls          4.0.1    /Users/mac10.12/trying/coveralls-python
docopt             0.6.2
idna               3.7
iniconfig          2.0.0
packaging          24.0
pip                24.0
pluggy             1.5.0
pytest             8.2.2
PyYAML             6.0.1
requests           2.32.3
responses          0.25.0
setuptools         69.5.1
urllib3            2.2.1

Trace Logs
Provide coverage logs w/ DEBUG logging enabled (run coverage debug ...)

  • coverage debug sys
-- sys -------------------------------------------------------
               coverage_version: 7.5.3
                coverage_module: /Users/mac10.12/Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/lib/python3.11/site-packages/coverage/__init__.py
                           core: -none-
                        CTracer: available
           plugins.file_tracers: -none-
            plugins.configurers: -none-
      plugins.context_switchers: -none-
              configs_attempted: /Users/mac10.12/trying/coveralls-python/.coveragerc
                                 /Users/mac10.12/trying/coveralls-python/setup.cfg
                                 /Users/mac10.12/trying/coveralls-python/tox.ini
                                 /Users/mac10.12/trying/coveralls-python/pyproject.toml
                   configs_read: /Users/mac10.12/trying/coveralls-python/tox.ini
                                 /Users/mac10.12/trying/coveralls-python/pyproject.toml
                    config_file: None
                config_contents: -none-
                      data_file: -none-
                         python: 3.11.8 (main, Apr  1 2024, 03:30:09) [Clang 13.0.0 (clang-1300.0.29.30)]
                       platform: macOS-11.7.10-x86_64-i386-64bit
                 implementation: CPython
                     executable: /Users/mac10.12/Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/bin/python
                   def_encoding: utf-8
                    fs_encoding: utf-8
                            pid: 49413
                            cwd: /Users/mac10.12/trying/coveralls-python
                           path: /Users/mac10.12/Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/bin
                                 /usr/local/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python311.zip
                                 /usr/local/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11
                                 /usr/local/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload
                                 /Users/mac10.12/Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/lib/python3.11/site-packages
                                 /Users/mac10.12/trying/coveralls-python
                                 /usr/local/opt/[email protected]/libexec
                    environment: HOME = /Users/mac10.12
                                 PYTHONDONTWRITEBYTECODE = 1
                   command_line: /Users/mac10.12/Library/Caches/pypoetry/virtualenvs/coveralls-6KVgLntz-py3.11/bin/coverage debug sys
         sqlite3_sqlite_version: 3.45.3
             sqlite3_temp_store: 0
        sqlite3_compile_options: ATOMIC_INTRINSICS=1, COMPILER=clang-13.0.0, DEFAULT_AUTOVACUUM,
                                 DEFAULT_CACHE_SIZE=-2000, DEFAULT_FILE_FORMAT=4,
                                 DEFAULT_JOURNAL_SIZE_LIMIT=-1, DEFAULT_MMAP_SIZE=0, DEFAULT_PAGE_SIZE=4096,
                                 DEFAULT_PCACHE_INITSZ=20, DEFAULT_RECURSIVE_TRIGGERS,
                                 DEFAULT_SECTOR_SIZE=4096, DEFAULT_SYNCHRONOUS=2,
                                 DEFAULT_WAL_AUTOCHECKPOINT=1000, DEFAULT_WAL_SYNCHRONOUS=2,
                                 DEFAULT_WORKER_THREADS=0, DIRECT_OVERFLOW_READ, ENABLE_API_ARMOR,
                                 ENABLE_COLUMN_METADATA, ENABLE_DBSTAT_VTAB, ENABLE_FTS3,
                                 ENABLE_FTS3_PARENTHESIS, ENABLE_FTS4, ENABLE_FTS5, ENABLE_GEOPOLY,
                                 ENABLE_MATH_FUNCTIONS, ENABLE_MEMORY_MANAGEMENT, ENABLE_PREUPDATE_HOOK,
                                 ENABLE_RTREE, ENABLE_SESSION, ENABLE_STAT4, ENABLE_UNLOCK_NOTIFY,
                                 MALLOC_SOFT_LIMIT=1024, MAX_ATTACHED=10, MAX_COLUMN=2000,
                                 MAX_COMPOUND_SELECT=500, MAX_DEFAULT_PAGE_SIZE=8192, MAX_EXPR_DEPTH=1000,
                                 MAX_FUNCTION_ARG=127, MAX_LENGTH=1000000000, MAX_LIKE_PATTERN_LENGTH=50000,
                                 MAX_MMAP_SIZE=0x7fff0000, MAX_PAGE_COUNT=0xfffffffe, MAX_PAGE_SIZE=65536,
                                 MAX_SQL_LENGTH=1000000000, MAX_TRIGGER_DEPTH=1000,
                                 MAX_VARIABLE_NUMBER=250000, MAX_VDBE_OP=250000000, MAX_WORKER_THREADS=8,
                                 MUTEX_PTHREADS, SYSTEM_MALLOC, TEMP_STORE=1, THREADSAFE=1, USE_URI

Other
When virtual environment was create by python -m venv, it was able to run pytest without any error raised.

@waketzheng waketzheng changed the title poetry run pytes raises SyntaxError: invalid escape sequence \S poetry run pytest raises SyntaxError: invalid escape sequence \S Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants