Hi, I'm having issues getting the DocTests to run as a seperate file using the built in DocTests feature (creating a file name.doctest file and pressing play). The DocTest file works when calling existing packages, but if I do the following:
New top-level folder called "HelloWorld"
New script called "helloworld.py" with the following code:
def get_hello(name):
return "Hello " + name
Then create a "helloworld.doctest" with the following:
>>> import helloworld
>>> helloworld.get_hello("Richard")
'Hello Richard'
Then run the DocTest by pressing play (pressing play using the default template passes), I get the following error:
ImportError: No module named 'helloworld'
NameError: name 'helloworld' is not defined
If I add the DocTest into the comment of the method, running DocTest works on that script. But I want to remove clutter and have the tests in a seperate file and use this feature.
def get_hello(name):
"""
>>> get_hello("Richard")
'Hello Richard'
"""
return "Hello " + name
Is there something I'm missing? Any help will be most appreciated