mirror of
https://github.com/tc39/test262.git
synced 2025-07-29 08:54:35 +02:00
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:
|
for err in expected:
|
||||||
self.assertIn(err, stderr)
|
self.assertIn(err, stderr)
|
||||||
|
|
||||||
|
test.__name__ = 'test_' + file_name.split('.')[0]
|
||||||
return test
|
return test
|
||||||
|
|
||||||
dirname = os.path.join(os.path.abspath(testDir), 'fixtures')
|
dirname = os.path.join(os.path.abspath(testDir), 'fixtures')
|
||||||
@ -99,7 +100,6 @@ for file_name in os.listdir(dirname):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
t = create_file_test(file_name, full_path)
|
t = create_file_test(file_name, full_path)
|
||||||
t.__name__ = 'test_' + file_name
|
|
||||||
setattr(TestLinter, t.__name__, t)
|
setattr(TestLinter, t.__name__, t)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user