0

I have a 'test engine' (which is a big python script that defines a lot of functions) that can run multiple 'test suites' (which are also just python scripts, that uses the functions from the test-engine to define some custom tests).

It is intended that the test-cases should be written by non-programmers so for pedagogic reasons I want to enforce that they give their scripts a .tcs extension instead of a .py extension.

When they doubleclick the main-application, the test engine will find all the .tcs files in the same directory using glob() and import all of them to execute their statements sequentially.

Paul H
  • 901
  • 2
  • 7
  • 12
  • Thanks for pointing me to that discussion. `imp.load_source("testscript","testscript.tcs")` solves the problem – Paul H Apr 14 '14 at 13:28

1 Answers1

1

Thanks to Alex Thornton for pointing out the solution.

imp.load_source("importname","script.extension")

Community
  • 1
  • 1
Paul H
  • 901
  • 2
  • 7
  • 12