I'm new using python on kubuntu. I'm writing some simple functions and write also tests on pytest to practise test-driven-development (although I know it's wasted on such easy functions, it's just for the sake of practice).
Because I'm beginner, I'm writing the code in an editor and I'm executing it on the terminal, in a next step I'll use an IDE like Thonny. I have installed Python3.7, although Python2.7 seems to be the standard within the system. Nonetheless, the file with the functions works fine. I'm printing some f-strings and it works fine also. The first line of the file is a Shebang which tells the interpreter, to use Python3.7 (#!/usr/bin/env python3.7). However, when I want to execute the tests, I'm writing pytest in console, as indicated by the pytest-introduction. Alas, I get a syntax error, because it seems that pytest is importing Python2.7 which of course doesn't know f-strings.
I verified that pytest is indeed importing Python2.7 by executing the command pytest --version and I was confirmed.
My question is: How can I make pytest to import Python3.7 so the test would pass or at least the Syntaxerror would go away? Replacing the f-string with a normal string makes the test pass, so I'm assuming this is the only problem.
Any help is highly appreciated. Many thanks in advance. I hope, I gave all the relevant informations. If more information is needed, I'll provide that gladly.
You can install pytest with pip3. For most libraries, pip3 defaults to python3.x and pip defaults to python2.x
import pytest from Python3.7 instead 2.7