[snip]
> Script abc.py imports xyz.py.
> Now when I execute abc.py from commandlline all unittestcases of
> xyz.py are also executed.
> Why is this happening and what can be the solution to this.
anything that's in the global scope of an imported module gets executed.
For example...
------ a.py
print "hello"
------------
>>> import a
This will cause the "hello" to be printed from 'a.py' because it's in
the global scope.
so what you want to do is something like this:
-----a.py
def main():
print "hello"
if __name__ == "__main__":
main()
-------
Now if you do
>>> import a
nothing will be printed.
But, if you do "python a.py" on command line, you'll see "hello" be printed.
I think this is the problem you're having.
HTH,
-Luke
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor