Pycharm runs my selenium test suites twice

Trying to figure out why Pycharm is running my selenium test suites twice.  Recently upgraded from the Community Edition to the paid version.  Did not have this issue before using the community edition.

I run my scripts that control my Selenium test suites within Pycharm and when I do:


The tests run once as the UI says "Instantiating test...".  At this point it doesn't really detail what it is doing but the tests start to run one by one.

The test run again after they complete and the UI says "Running Tests..." but this time it shows in the UI each test that is run and the time taken.


The python is written as just a script with no functions (main() or otherwise).


If I add in a line that says:

if __name__ == "__main__":


and through the functionality into a function called main(), then the script runs only once, but then the parts of the script that create files for reporting never seem to run. 

Not sure why I never had this issue before.  Wondering if there is a setting I am missing in Pycharm that controls this or if my code needs to change.

Please sign in to leave a comment.