Commit b4445f9f authored by Michal Čihař's avatar Michal Čihař

Make dynamic class generation compatibile with Python 3

Use basic interface which is provided by type() we really do not need
anything more complex.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent a4d97430
......@@ -22,10 +22,6 @@ from __future__ import print_function
from unittest import SkipTest
import time
import os
try:
from types import new_class
except ImportError:
from new import classobj as new_class
import json
import base64
from six.moves.http_client import HTTPConnection
......@@ -318,16 +314,16 @@ def create_extra_classes():
Create classes for testing with other browsers
'''
classes = {}
for platform in EXTRA_PLATFORMS:
classdict = dict(SeleniumTests.__dict__)
for platform, caps in EXTRA_PLATFORMS.items():
name = '{}_{}'.format(
platform,
SeleniumTests.__name__,
)
classdict = dict(SeleniumTests.__dict__)
classdict.update({
'caps': EXTRA_PLATFORMS[platform],
'caps': caps,
})
classes[name] = new_class(name, (SeleniumTests,), classdict)
classes[name] = type(name, (SeleniumTests,), classdict)
globals().update(classes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment