Skip to content

Commit 12802a4

Browse files
committed
tests: use plain open instead of codecs.open
Since it has been deprecated
1 parent 4205249 commit 12802a4

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4242

4343
import ast
44-
import codecs
4544
import os
4645

4746
from setuptools import setup
@@ -68,7 +67,7 @@ def get_version():
6867
6968
:return: a string, indicating the version
7069
"""
71-
version_file = codecs.open(os.path.join("elasticapm", "version.py"), encoding="utf-8")
70+
version_file = open(os.path.join("elasticapm", "version.py"), encoding="utf-8")
7271
for line in version_file:
7372
if line.startswith("__version__"):
7473
version_tuple = ast.literal_eval(line.split(" = ")[1])

tests/fixtures.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31-
import codecs
3231
import gzip
3332
import io
3433
import itertools
@@ -75,11 +74,11 @@
7574
SPAN_TYPES = json.load(f)
7675

7776

78-
with codecs.open(ERRORS_SCHEMA, encoding="utf8") as errors_json, codecs.open(
77+
with open(ERRORS_SCHEMA, encoding="utf8") as errors_json, open(
7978
TRANSACTIONS_SCHEMA, encoding="utf8"
80-
) as transactions_json, codecs.open(SPAN_SCHEMA, encoding="utf8") as span_json, codecs.open(
79+
) as transactions_json, open(SPAN_SCHEMA, encoding="utf8") as span_json, open(
8180
METRICSET_SCHEMA, encoding="utf8"
82-
) as metricset_json, codecs.open(
81+
) as metricset_json, open(
8382
METADATA_SCHEMA, encoding="utf8"
8483
) as metadata_json:
8584
VALIDATORS = {

tests/utils/test_wildcard_matcher_cases/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2828
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30-
import codecs
3130
import json
3231
import os
3332

@@ -40,7 +39,7 @@ def pytest_generate_tests(metafunc):
4039
json_cases = os.path.join(
4140
os.path.dirname(__file__), "..", "..", "upstream", "json-specs", "wildcard_matcher_tests.json"
4241
)
43-
with codecs.open(json_cases, encoding="utf8") as test_cases_file:
42+
with open(json_cases, encoding="utf8") as test_cases_file:
4443
test_cases = json.load(test_cases_file)
4544
for test_case, pattern_sets in test_cases.items():
4645
for pattern, texts in pattern_sets.items():

0 commit comments

Comments
 (0)