Skip to content

Commit 6ffbe57

Browse files
authored
TEST: Add python=3.9 (#574)
* TEST: Add python=3.9 * TEST: Remove dependency on `tables`
1 parent 5ba28ab commit 6ffbe57

File tree

3 files changed

+3
-90
lines changed

3 files changed

+3
-90
lines changed

.github/workflows/test.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ on:
1717
branches:
1818
- master
1919
pull_request:
20-
20+
2121
jobs:
2222
tests:
2323
runs-on: ${{ matrix.os }}
2424
strategy:
2525
matrix:
2626
os: [windows-latest, ubuntu-latest, macos-latest]
27-
python-version: [3.7, 3.8]
27+
python-version: [3.7, 3.8, 3.9]
2828
exclude:
2929
- os: windows-latest
3030
python-version: 3.7
@@ -38,7 +38,6 @@ jobs:
3838
run: |
3939
python -m pip install --upgrade pip
4040
pip install -U nose coverage numpy scipy pandas numba sympy ipython statsmodels flake8
41-
pip install tables
4241
python setup.py install
4342
- name: Run Tests
4443
run: |

quantecon/tests/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
@date : 2014-08-01 13:13:59
77
88
"""
9-
from . util import (capture, get_data_dir, get_h5_data_file, write_array,
10-
max_abs_diff, get_h5_data_group)
9+
from . util import capture, get_data_dir, max_abs_diff

quantecon/tests/util.py

-85
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
"""
55
import sys
66
import os
7-
from os.path import join, exists
87
from contextlib import contextmanager
98
import numpy as np
10-
import tables
119

1210
if sys.version_info[0] == 2:
1311
from cStringIO import StringIO
@@ -48,89 +46,6 @@ def get_data_dir():
4846
return data_dir
4947

5048

51-
def get_h5_data_file():
52-
"""
53-
return the data file used for holding test data. If the data
54-
directory or file do not exist, they are created.
55-
56-
Notes
57-
-----
58-
This should ideally be called from a context manage as so::
59-
60-
with get_h5_data_file() as f:
61-
# do stuff
62-
63-
This way we know the file will be closed and cleaned up properly
64-
65-
"""
66-
data_dir = get_data_dir()
67-
68-
if not exists(data_dir):
69-
os.mkdir(data_dir)
70-
71-
data_file = join(data_dir, "testing_data.h5")
72-
73-
return tables.open_file(data_file, "a", "Data for quantecon tests")
74-
75-
76-
def get_h5_data_group(grp_name, parent="/", f=get_h5_data_file()):
77-
"""
78-
Try to fetch the group named grp_name from the file f. If it doesn't
79-
yet exist, it is created
80-
81-
Parameters
82-
----------
83-
grp_name : str
84-
A string specifying the name of the new group. This should be
85-
only the group name, not including any information about the
86-
group's parent (path)
87-
88-
parent : str, optional(default="/")
89-
The parent or path for where the group should live. If nothing
90-
is given, the group will be created at the root node `"/"`
91-
92-
f : hdf5 file, optional(default=get_h5_data_file())
93-
The file where this should happen. The default is the data file
94-
for these tests
95-
96-
Returns
97-
-------
98-
existed : bool
99-
A boolean specifying whether the group existed or was created
100-
101-
group : tables.Group
102-
The requested group
103-
104-
Examples
105-
--------
106-
with get_h5_data_file() as f:
107-
my_group = get_h5_data_group("jv") # data for jv tests
108-
109-
Notes
110-
-----
111-
As with other code dealing with I/O from files, it is best to call
112-
this function within a context manager as shown in the example.
113-
114-
"""
115-
existed = True
116-
try:
117-
group = f.getNode(parent + grp_name)
118-
except:
119-
# doesn't exist
120-
existed = False
121-
msg = "data for {} tests".format(grp_name + ".py")
122-
group = f.create_group(parent, grp_name, msg)
123-
124-
return existed, group
125-
126-
127-
def write_array(f, grp, array, name):
128-
"stores array in into group grp of h5 file f under name name"
129-
atom = tables.Atom.from_dtype(array.dtype)
130-
ds = f.createCArray(grp, name, atom, array.shape)
131-
ds[:] = array
132-
133-
13449
def max_abs_diff(a1, a2):
13550
"return max absolute difference between two arrays"
13651
return np.max(np.abs(a1 - a2))

0 commit comments

Comments
 (0)