Skip to content

Commit 0018cc5

Browse files
s-t-e-v-e-n-kjonbannister
authored andcommitted
all: Remove all Python 2 requirements, such as six
Now that the minimum version of Python required is 3.6, we can remove all uses of six and future, along with some other test changes that still support Python 2. Fixes #209
1 parent ce6b157 commit 0018cc5

File tree

32 files changed

+87
-170
lines changed

32 files changed

+87
-170
lines changed

pytest-devpi-server/_pytest_devpi_server/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
44
@author: eeaston
55
'''
6+
import io
67
import os
78
import sys
89
import zipfile
910
import logging
10-
from six.moves import cStringIO
1111

1212
from pytest import yield_fixture, fixture
1313
import devpi_server as _devpi_server
@@ -105,7 +105,7 @@ def api(self, *args):
105105
client_args.extend(args)
106106
client_args.extend(['--clientdir', str(self.client_dir)])
107107
log.info(' '.join(client_args))
108-
captured = cStringIO()
108+
captured = io.StringIO()
109109
stdout = sys.stdout
110110
sys.stdout = captured
111111
try:

pytest-devpi-server/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
'pytest',
2323
'devpi-server>=3.0.1',
2424
'devpi-client',
25-
'six',
2625
'ruamel.yaml>=0.15',
2726
]
2827

pytest-fixture-config/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
install_requires = ['pytest']
2222

23-
tests_require = ['six',
24-
]
23+
tests_require = []
2524

2625
if __name__ == '__main__':
2726
kwargs = common_setup('pytest_fixture_config')

pytest-fixture-config/tests/unit/test_fixture_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import importlib
2+
13
import pytest
2-
from six.moves import reload_module
34

45
# HACK: if the plugin is imported before the coverage plugin then all
56
# the top-level code will be omitted from coverage, so force it to be
67
# reloaded within this unit test under coverage
78
import pytest_fixture_config
8-
reload_module(pytest_fixture_config)
9+
importlib.reload(pytest_fixture_config)
910

1011
from pytest_fixture_config import Config, requires_config, yield_requires_config
1112

pytest-listener/pytest_listener.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
import collections
44
import json
55
import logging
6+
import pickle
67
import socket
78
import time
89
from threading import Thread, Event
910
from time import sleep
1011

1112
import pytest
12-
from six import string_types
13-
from six.moves import cPickle
1413
from pytest_server_fixtures.base import get_ephemeral_port, get_ephemeral_host
1514

1615
TERMINATOR = json.dumps(['STOP']).encode('utf-8')
@@ -64,7 +63,7 @@ def __str__(self):
6463
return 'TimedMsg: %s (@ %s)' % (str(self.value), self.time)
6564

6665
def pickled(self):
67-
return cPickle.dumps(self)
66+
return pickle.dumps(self)
6867

6968

7069
class Listener(Thread):
@@ -119,7 +118,7 @@ def get_data(self):
119118
return None, None
120119

121120
try:
122-
data = cPickle.loads(data)
121+
data = pickle.loads(data)
123122
except:
124123
try:
125124
data = data.decode('utf-8')
@@ -133,7 +132,7 @@ def get_data(self):
133132
if isinstance(data, TimedMsg):
134133
d = data.value
135134
t = data.time
136-
elif isinstance(data, string_types):
135+
elif isinstance(data, str):
137136
try:
138137
d = json.loads(data)
139138
except:

pytest-listener/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
'Programming Language :: Python :: 3.7',
1919
]
2020

21-
install_requires = ['six',
22-
'pytest',
21+
install_requires = ['pytest',
2322
'pytest-server-fixtures'
2423
]
2524

pytest-profiling/pytest_profiling.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""pytest: avoid already-imported warning: PYTEST_DONT_REWRITE."""
22

3-
from __future__ import absolute_import
4-
53
import sys
64
import os
75
import cProfile
@@ -10,16 +8,15 @@
108
from hashlib import md5
119
import subprocess
1210

13-
import six
1411
import pytest
1512

1613
LARGE_FILENAME_HASH_LEN = 8
1714

1815

1916
def clean_filename(s):
2017
forbidden_chars = set(r'/?<>\:*|"')
21-
return six.text_type("".join(c if c not in forbidden_chars and ord(c) < 127 else '_'
22-
for c in s))
18+
return str("".join(c if c not in forbidden_chars and ord(c) < 127 else '_'
19+
for c in s))
2320

2421

2522
class Profiling(object):

pytest-profiling/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
'Programming Language :: Python :: 3.12',
2525
]
2626

27-
install_requires = ['six',
28-
'pytest',
27+
install_requires = ['pytest',
2928
'gprof2dot',
3029
]
3130

pytest-profiling/tests/unit/test_profile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# the top-level code in pytest_profiling will be omitted from
33
# coverage, so force it to be reloaded within this test unit under coverage
44

5+
import importlib
56
import os.path
6-
from six.moves import reload_module # @UnresolvedImport
77

88
import pytest_profiling
99

10-
reload_module(pytest_profiling)
10+
importlib.reload(pytest_profiling)
1111

1212
import os
1313
import subprocess

pytest-pyramid-server/pytest_pyramid_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
44
@author: eeaston
55
'''
6+
import configparser
67
import os
7-
from six.moves import configparser
88
import sys
99
import socket
1010
import glob

0 commit comments

Comments
 (0)