diff --git a/Lib/unittest.py b/Lib/unittest.py index 84520d86169..d781354ba42 100644 --- a/Lib/unittest.py +++ b/Lib/unittest.py @@ -1567,7 +1567,8 @@ Examples: return if len(args) > 0: self.testNames = args - self.module = None + if os.path.splitext(os.path.basename(__file__))[0] == 'unitest': + self.module = None else: self.testNames = (self.defaultTest,) self.createTests()