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/conftest.py b/tests/conftest.py
index d317c49..45a264a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -205,7 +205,11 @@
         from pybind11_tests.eigen import have_eigen
     except ImportError:
         have_eigen = False
-    pypy = platform.python_implementation() == "PyPy"
+
+    # Provide simple `six`-like aliases.
+    pytest.PY2 = (sys.version_info.major == 2)
+    pytest.CPYTHON = (platform.python_implementation() == "CPython")
+    pytest.PYPY = (platform.python_implementation() == "PyPy")
 
     skipif = pytest.mark.skipif
     pytest.suppress = suppress
@@ -215,13 +219,13 @@
                                              reason="eigen and/or numpy are not installed")
     pytest.requires_eigen_and_scipy = skipif(
         not have_eigen or not scipy, reason="eigen and/or scipy are not installed")
-    pytest.unsupported_on_pypy = skipif(pypy, reason="unsupported on PyPy")
-    pytest.bug_in_pypy = pytest.mark.xfail(pypy, reason="bug in PyPy")
-    pytest.unsupported_on_pypy3 = skipif(pypy and sys.version_info.major >= 3,
+    pytest.unsupported_on_pypy = skipif(pytest.PYPY, reason="unsupported on PyPy")
+    pytest.bug_in_pypy = pytest.mark.xfail(pytest.PYPY, reason="bug in PyPy")
+    pytest.unsupported_on_pypy3 = skipif(pytest.PYPY and not pytest.PY2,
                                          reason="unsupported on PyPy3")
-    pytest.unsupported_on_pypy_lt_6 = skipif(pypy and sys.pypy_version_info[0] < 6,
+    pytest.unsupported_on_pypy_lt_6 = skipif(pytest.PYPY and sys.pypy_version_info[0] < 6,
                                              reason="unsupported on PyPy<6")
-    pytest.unsupported_on_py2 = skipif(sys.version_info.major < 3,
+    pytest.unsupported_on_py2 = skipif(pytest.PY2,
                                        reason="unsupported on Python 2.x")
     pytest.gc_collect = gc_collect