Re: pytest run gives errors?

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hi Ed:

What command line and directory are you using to run pytest?

In message <PH7PR12MB56565B453D434715C3A4A16884889@PH7PR12MB5656.namprd12.prod.
outlook.com>,
Ed Trumbull writes:
>When I tried to run pytest I got tracebacks. (See attached file)

    from _pytest._code import ExceptionInfo
  File "/usr/local/lib/python3.10/dist-packages/_pytest/_code/__init__.py", line 2, in <module>
    from .code import Code
  File "/usr/local/lib/python3.10/dist-packages/_pytest/_code/code.py", line 2, in <module>
    import inspect
  File "/usr/lib/python3.10/inspect.py", line 43, in <module>
    import linecache
  File "/usr/lib/python3.10/linecache.py", line 11, in <module>
    import tokenize
  File "/usr/lib/python3.10/tokenize.py", line 36, in <module>
    from token import EXACT_TOKEN_TYPES
ImportError: cannot import name 'EXACT_TOKEN_TYPES' from 'token' (/usr/local/lib/python3.10/dist-packages/roundup-2.1.0-py3.10.egg/roundup/token.py)

It looks like

   /usr/local/lib/python3.10/dist-packages/roundup-2.1.0-py3.10.egg/roundup

is in the PYTHONPATH. As a result the:

  import token

done by tokenize is resolving to .../roundup/token.py not
/usr/lib/python3.10/token.py. Normally .../roundup/token.py would require

  from roundup.token import ....

to be used for the import.

  python3 -m site

might be useful for viewing the path.

If you are in the source tree, pytest should be run from the root of
the source tree (the parent directory of the test directory). Don't cd
to the roundup directory and run something like:

  python3 -m pytest ../test.

Also what OS are you running?

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.