Currently I have a project Euler to learn dragon I am working through practice. I have a directory and a directory to solve the problem that mirrors for this test. So ideally: Using php is very easy because I Just need the correct file, or you can modify How can this be achieved in a dragon? Obviously this is a very simple example - so some advice on how to reach it on a large scale, would also be very grateful. It depends on which test runner you want to use. pytest I've recently learned to like There is a section about it. If you can not import your main code into code then you can use the trick below. unittest When I use Import main or App.main with import
problem application main.py test maintest test Py
include_path .
unittest I do this:
Problem app Main.py test_main.py
test_main.py < / P>
Import Import Import Import Import sys.path.append Os.path.join (os.path.dirname (__ file__), 'app')) Import main # If __name__ == '__main__': unittest.run ()
problem App __init__.py main.py In tests test.py test_main.py >
test.py
import system import os import unittest sys.path.append (os.path.dirname (__ file__))
Test_main.py
Import App.main # from the test import; if __name__ == '__main__': unittest.run ()
No comments:
Post a Comment