summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2022-10-27 14:57:14 +0200
committerSebastian Berg <sebastianb@nvidia.com>2022-10-27 14:57:14 +0200
commit67841947b458f6bdc6c40d014512da9bc4717a3e (patch)
tree9683bb0863ef40219e3de2fb37013cef209a7edb /numpy/lib
parent2283052fd01138863a5741d84f358fdbea501bd9 (diff)
downloadnumpy-67841947b458f6bdc6c40d014512da9bc4717a3e.tar.gz
TST,MAINT: Replace most `setup` with `setup_method` (also teardown)
In some cases, the replacement is clearly not what is intended, in those (where setup was called explicitly), I mostly renamed `setup` to `_setup`. The `test_ccompile_opt` is a bit confusing, so left it right now (this will probably fail)
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/tests/test__datasource.py24
-rw-r--r--numpy/lib/tests/test_function_base.py2
-rw-r--r--numpy/lib/tests/test_histograms.py4
-rw-r--r--numpy/lib/tests/test_io.py4
-rw-r--r--numpy/lib/tests/test_recfunctions.py14
5 files changed, 24 insertions, 24 deletions
diff --git a/numpy/lib/tests/test__datasource.py b/numpy/lib/tests/test__datasource.py
index 2738d41c4..c8149abc3 100644
--- a/numpy/lib/tests/test__datasource.py
+++ b/numpy/lib/tests/test__datasource.py
@@ -87,11 +87,11 @@ def invalid_httpfile():
class TestDataSourceOpen:
- def setup(self):
+ def setup_method(self):
self.tmpdir = mkdtemp()
self.ds = datasource.DataSource(self.tmpdir)
- def teardown(self):
+ def teardown_method(self):
rmtree(self.tmpdir)
del self.ds
@@ -156,11 +156,11 @@ class TestDataSourceOpen:
class TestDataSourceExists:
- def setup(self):
+ def setup_method(self):
self.tmpdir = mkdtemp()
self.ds = datasource.DataSource(self.tmpdir)
- def teardown(self):
+ def teardown_method(self):
rmtree(self.tmpdir)
del self.ds
@@ -186,11 +186,11 @@ class TestDataSourceExists:
class TestDataSourceAbspath:
- def setup(self):
+ def setup_method(self):
self.tmpdir = os.path.abspath(mkdtemp())
self.ds = datasource.DataSource(self.tmpdir)
- def teardown(self):
+ def teardown_method(self):
rmtree(self.tmpdir)
del self.ds
@@ -251,11 +251,11 @@ class TestDataSourceAbspath:
class TestRepositoryAbspath:
- def setup(self):
+ def setup_method(self):
self.tmpdir = os.path.abspath(mkdtemp())
self.repos = datasource.Repository(valid_baseurl(), self.tmpdir)
- def teardown(self):
+ def teardown_method(self):
rmtree(self.tmpdir)
del self.repos
@@ -284,11 +284,11 @@ class TestRepositoryAbspath:
class TestRepositoryExists:
- def setup(self):
+ def setup_method(self):
self.tmpdir = mkdtemp()
self.repos = datasource.Repository(valid_baseurl(), self.tmpdir)
- def teardown(self):
+ def teardown_method(self):
rmtree(self.tmpdir)
del self.repos
@@ -317,10 +317,10 @@ class TestRepositoryExists:
class TestOpenFunc:
- def setup(self):
+ def setup_method(self):
self.tmpdir = mkdtemp()
- def teardown(self):
+ def teardown_method(self):
rmtree(self.tmpdir)
def test_DataSourceOpen(self):
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index e407fc78c..88d4987e6 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -850,7 +850,7 @@ class TestDiff:
class TestDelete:
- def setup(self):
+ def setup_method(self):
self.a = np.arange(5)
self.nd_a = np.arange(5).repeat(2).reshape(1, 5, 2)
diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py
index 89ee1b256..87643169b 100644
--- a/numpy/lib/tests/test_histograms.py
+++ b/numpy/lib/tests/test_histograms.py
@@ -11,10 +11,10 @@ import pytest
class TestHistogram:
- def setup(self):
+ def setup_method(self):
pass
- def teardown(self):
+ def teardown_method(self):
pass
def test_simple(self):
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index b39db72eb..87f476328 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -685,11 +685,11 @@ class LoadTxtBase:
class TestLoadTxt(LoadTxtBase):
loadfunc = staticmethod(np.loadtxt)
- def setup(self):
+ def setup_method(self):
# lower chunksize for testing
self.orig_chunk = np.lib.npyio._loadtxt_chunksize
np.lib.npyio._loadtxt_chunksize = 1
- def teardown(self):
+ def teardown_method(self):
np.lib.npyio._loadtxt_chunksize = self.orig_chunk
def test_record(self):
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py
index d8385f8be..0c919a53d 100644
--- a/numpy/lib/tests/test_recfunctions.py
+++ b/numpy/lib/tests/test_recfunctions.py
@@ -20,7 +20,7 @@ zip_dtype = np.lib.recfunctions._zip_dtype
class TestRecFunctions:
# Misc tests
- def setup(self):
+ def setup_method(self):
x = np.array([1, 2, ])
y = np.array([10, 20, 30])
z = np.array([('A', 1.), ('B', 2.)],
@@ -381,7 +381,7 @@ class TestRecursiveFillFields:
class TestMergeArrays:
# Test merge_arrays
- def setup(self):
+ def setup_method(self):
x = np.array([1, 2, ])
y = np.array([10, 20, 30])
z = np.array(
@@ -514,7 +514,7 @@ class TestMergeArrays:
class TestAppendFields:
# Test append_fields
- def setup(self):
+ def setup_method(self):
x = np.array([1, 2, ])
y = np.array([10, 20, 30])
z = np.array(
@@ -567,7 +567,7 @@ class TestAppendFields:
class TestStackArrays:
# Test stack_arrays
- def setup(self):
+ def setup_method(self):
x = np.array([1, 2, ])
y = np.array([10, 20, 30])
z = np.array(
@@ -737,7 +737,7 @@ class TestStackArrays:
class TestJoinBy:
- def setup(self):
+ def setup_method(self):
self.a = np.array(list(zip(np.arange(10), np.arange(50, 60),
np.arange(100, 110))),
dtype=[('a', int), ('b', int), ('c', int)])
@@ -902,7 +902,7 @@ class TestJoinBy:
class TestJoinBy2:
@classmethod
- def setup(cls):
+ def setup_method(cls):
cls.a = np.array(list(zip(np.arange(10), np.arange(50, 60),
np.arange(100, 110))),
dtype=[('a', int), ('b', int), ('c', int)])
@@ -971,7 +971,7 @@ class TestAppendFieldsObj:
"""
# https://github.com/numpy/numpy/issues/2346
- def setup(self):
+ def setup_method(self):
from datetime import date
self.data = dict(obj=date(2000, 1, 1))