Skip to content

Commit 287bf41

Browse files
committed
preserve case in test descriptions; remove unused imports; properly specify module in which dynamically created classes live
1 parent 9c57faa commit 287bf41

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/test_unified_format.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
globals().update(generate_test_classes(
2828
os.path.join(_TEST_PATH, 'valid-pass'),
29+
module=__name__,
2930
name_prefix='unified_test_format'))
3031

3132

test/unified_format.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
from bson import json_util
2626

27-
from pymongo.mongo_client import MongoClient
2827
from pymongo.write_concern import WriteConcern
2928

3029
from test import client_context, unittest, IntegrationTest
@@ -239,13 +238,13 @@ def test_case(self):
239238
for test_spec in cls.TEST_SPEC['tests']:
240239
description = test_spec['description']
241240
test_name = 'test_%s' % (
242-
description.replace(' ', '_').replace('.', '_').lower(),)
241+
description.replace(' ', '_').replace('.', '_'),)
243242
test_method = create_test(copy.deepcopy(test_spec))
244243
test_method.__name__ = test_name
245244
setattr(cls, test_name, test_method)
246245

247246

248-
def generate_test_classes(test_path, name_prefix=''):
247+
def generate_test_classes(test_path, module=__name__, name_prefix=''):
249248
"""Method for generating test classes. Returns a dictionary where keys are
250249
the names of test classes and values are the test class objects."""
251250
test_klasses = {}
@@ -281,6 +280,6 @@ class SpecTestBase(with_metaclass(UnifiedSpecTestMeta)):
281280
test_klasses[class_name] = type(
282281
class_name,
283282
(UnifiedSpecTestMixin, test_base_class_factory(scenario_def),),
284-
{})
283+
{'__module__': module})
285284

286285
return test_klasses

0 commit comments

Comments
 (0)