5
Running a file other than the main file for Unit Testing
LeonGrin (12)

I created a test_main.py file to unit test the main.py file. But every time I click "Run", it only runs the main.py file. Is it possible to run a file other than the main file?

You are viewing a single comment. View All
2
fandressouza (2)

In case someone is looking to simply run a file use:

#main.py
import os
os.system('python3 <filename>.py')
1
m201713 (0)

@fandressouza
how did you do that?
if i click the run icon, it show me like this

sh: 1: cannot open Ex01: No such file

2
fandressouza (2)

@m201713 make sure you remove "<>", if your file is called second.py you must write the following:

#main.py
import os
os.system('python3 second.py')