tests: Consolidate version (2 vs. 3) and platform (CPython vs. PyPy) checks (#2376)
Fix logic in test_bytes_to_string
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
diff --git a/tests/test_stl_binders.py b/tests/test_stl_binders.py
index baa0f4e..4cb4591 100644
--- a/tests/test_stl_binders.py
+++ b/tests/test_stl_binders.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import pytest
-import sys
from pybind11_tests import stl_binders as m
with pytest.suppress(ImportError):
@@ -77,7 +76,7 @@
assert v[1] == 2
v[2] = 5
mv = memoryview(v) # We expose the buffer interface
- if sys.version_info.major > 2:
+ if not pytest.PY2:
assert mv[2] == 5
mv[2] = 6
else:
@@ -85,7 +84,7 @@
mv[2] = '\x06'
assert v[2] == 6
- if sys.version_info.major > 2:
+ if not pytest.PY2:
mv = memoryview(b)
v = m.VectorUChar(mv[::2])
assert v[1] == 3