summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test__datasource.py
diff options
context:
space:
mode:
authorSeth Troisi <sethtroisi@google.com>2020-01-08 23:49:17 -0800
committerSeth Troisi <sethtroisi@google.com>2020-01-15 13:19:56 -0800
commit1427484e9015e73b7017ee9336ce914a6f15187b (patch)
tree2db89078addee6a01697ab8bd4160c25d59fffc4 /numpy/lib/tests/test__datasource.py
parentb6bc0941d4f07310456079ab2497c3d1bde4a5e7 (diff)
downloadnumpy-1427484e9015e73b7017ee9336ce914a6f15187b.tar.gz
MAINT: Remove sys.version checks in tests
Diffstat (limited to 'numpy/lib/tests/test__datasource.py')
-rw-r--r--numpy/lib/tests/test__datasource.py29
1 files changed, 3 insertions, 26 deletions
diff --git a/numpy/lib/tests/test__datasource.py b/numpy/lib/tests/test__datasource.py
index fdd22347d..d3bd88d7f 100644
--- a/numpy/lib/tests/test__datasource.py
+++ b/numpy/lib/tests/test__datasource.py
@@ -9,14 +9,9 @@ from numpy.testing import (
assert_, assert_equal, assert_raises, assert_warns
)
-if sys.version_info[0] >= 3:
- import urllib.request as urllib_request
- from urllib.parse import urlparse
- from urllib.error import URLError
-else:
- import urllib2 as urllib_request
- from urlparse import urlparse
- from urllib2 import URLError
+import urllib.request as urllib_request
+from urllib.parse import urlparse
+from urllib.error import URLError
def urlopen_stub(url, data=None):
@@ -162,24 +157,6 @@ class TestDataSourceOpen:
fp.close()
assert_equal(magic_line, result)
- @pytest.mark.skipif(sys.version_info[0] >= 3, reason="Python 2 only")
- def test_Bz2File_text_mode_warning(self):
- try:
- import bz2
- except ImportError:
- # We don't have the bz2 capabilities to test.
- pytest.skip()
- # Test datasource's internal file_opener for BZip2 files.
- filepath = os.path.join(self.tmpdir, 'foobar.txt.bz2')
- fp = bz2.BZ2File(filepath, 'w')
- fp.write(magic_line)
- fp.close()
- with assert_warns(RuntimeWarning):
- fp = self.ds.open(filepath, 'rt')
- result = fp.readline()
- fp.close()
- assert_equal(magic_line, result)
-
class TestDataSourceExists:
def setup(self):