This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Python 3 support: fix server/ui/statsTester.py test discovery
ClosedPublic

Authored by thopre on Oct 12 2019, 3:46 PM.

Details

Summary

Unit test server/ui/statsTester.py is invoked with an extra parameter
which confuses unittest test discovery. Indeed, when parameter
defaultTest of unittest.main() method is in its default value the test
to run is taken from argv parameter if not empty. argv parameter in turn
defaults to sys.argv and thus unittest will take the first parameter for
the name of the test to execute.

Under Python 2 this would throw an AttributeError which would pass
through all the way up to the test itself which contains a catch to
remove the parameter and try again. Note that the exception is not
documented. Under Python 3 the exception is caught by the unittest
framework which exits with an error.

Since the parameter that confuses the test discovery is a temporary
LNT instance directory which is not used by the test, this commit simply
removes these LIT steps and only call the unittest without parameter.

Event Timeline

thopre created this revision.Oct 12 2019, 3:46 PM
This revision is now accepted and ready to land.Dec 5 2019, 3:48 PM
thopre closed this revision.Dec 6 2019, 1:35 AM