0

I ran the osetests --rednose --nocapture test_report.py

I got type for print(cls.__class__.__name__), but I expected TestReport

and /usr/local/bin/nosetests for os.path.splitext(sys.modules['__main__'].__file__)[0], but I expected test_report

How to get it ?

class TestReport(unittest.TestCase):

    @classmethod
    def setup_class(cls):
        print(cls.__class__.__name__)
        ap(os.path.splitext(sys.modules['__main__'].__file__))
        TESTING_NAME=os.path.splitext(sys.modules['__main__'].__file__)[0]
        print("testing script name:"+TESTING_NAME)
newBike
  • 14,385
  • 29
  • 109
  • 192

1 Answers1

0

Since the cls parameter is most certainly a class, the class of a class is of the type type, and that's what you got when you tried to get the __name__ of it. Just try cls.__name__ and see if that gives you what you expect.

metatoaster
  • 17,419
  • 5
  • 55
  • 66