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 ...@@ -22,10 +22,6 @@ from __future__ import print_function
from unittest import SkipTest from unittest import SkipTest
import time import time
import os import os
try:
from types import new_class
except ImportError:
from new import classobj as new_class
import json import json
import base64 import base64
from six.moves.http_client import HTTPConnection from six.moves.http_client import HTTPConnection
...@@ -318,16 +314,16 @@ def create_extra_classes(): ...@@ -318,16 +314,16 @@ def create_extra_classes():
Create classes for testing with other browsers Create classes for testing with other browsers
''' '''
classes = {} classes = {}
for platform in EXTRA_PLATFORMS: for platform, caps in EXTRA_PLATFORMS.items():
classdict = dict(SeleniumTests.__dict__)
name = '{}_{}'.format( name = '{}_{}'.format(
platform, platform,
SeleniumTests.__name__, SeleniumTests.__name__,
) )
classdict = dict(SeleniumTests.__dict__)
classdict.update({ classdict.update({
'caps': EXTRA_PLATFORMS[platform], 'caps': caps,
}) })
classes[name] = new_class(name, (SeleniumTests,), classdict) classes[name] = type(name, (SeleniumTests,), classdict)
globals().update(classes) 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