mirror of https://github.com/tc39/test262.git
lint: Compute ergonomic name for tests
The command-line interface to Python's "unittest" module allows users to run tests by name, e.g. $ test.py TestLinter.test_foo If the tests include a period, they cannot be referenced in this way. Rename the tests to omit the filename extension so that they may be referenced from the command-line in this way.
This commit is contained in:
parent
f38748efc1
commit
bb5a6622d4
|
@ -89,6 +89,7 @@ def create_file_test(name, fspath):
|
|||
for err in expected:
|
||||
self.assertIn(err, stderr)
|
||||
|
||||
test.__name__ = 'test_' + file_name.split('.')[0]
|
||||
return test
|
||||
|
||||
dirname = os.path.join(os.path.abspath(testDir), 'fixtures')
|
||||
|
@ -99,7 +100,6 @@ for file_name in os.listdir(dirname):
|
|||
continue
|
||||
|
||||
t = create_file_test(file_name, full_path)
|
||||
t.__name__ = 'test_' + file_name
|
||||
setattr(TestLinter, t.__name__, t)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue