Skip to content

pytest -v test.py throwing an error #27

@yevyev

Description

@yevyev

=========================================================================== test session starts ============================================================================
platform linux2 -- Python 2.7.18, pytest-4.6.9, py-1.8.1, pluggy-0.13.0 -- /usr/bin/python2
cachedir: .pytest_cache
rootdir: /home/yev/Documents/PyProjects/tinypythonprojects/tiny_python_projects/01_hello
collected 0 items / 1 errors

================================================================================== ERRORS ==================================================================================
_________________________________________________________________________ ERROR collecting test.py _________________________________________________________________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
import(modname)
E File "/home/yev/Documents/PyProjects/tinypythonprojects/tiny_python_projects/01_hello/test.py", line 21
E out = getoutput(f'python3 {prg}')
E ^
E SyntaxError: invalid syntax
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================= 1 error in 0.09 seconds ==========================================================================

I'm unsure why it's using python2, and how to fix this.

I'm using Ubuntu 20.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions