1
1
# All routines for testing CFA general methods.
2
- import os
3
-
4
- import pytest
5
2
import xarray as xr
6
3
7
4
TESTDIR = 'cfapyx/tests/test_space'
8
5
9
6
class TestCFARead :
10
7
11
- def test_cfa_pure (self , testdir = TESTDIR , active = False ):
8
+ def test_cfa_pure (self , testdir = TESTDIR ):
12
9
13
10
FILE = f'{ testdir } /testrain.nca'
14
11
15
12
# Local testing: Add CFAPyX before tests
16
13
try :
17
- ds = xr .open_dataset (FILE , engine = 'CFA' ,
18
- cfa_options = {
19
- 'use_active' :active
20
- })
14
+ ds = xr .open_dataset (FILE , engine = 'CFA' )
21
15
except Exception as err :
22
16
assert isinstance (err , ImportError )
23
- print (f 'Integration tests: Read(pure, active= { active } ) - skipped' )
17
+ print ('Integration tests: Read(pure) - skipped' )
24
18
return
25
19
26
20
## Test global dataset
@@ -48,7 +42,7 @@ def test_cfa_pure(self, testdir=TESTDIR, active=False):
48
42
assert p_value .shape == ()
49
43
assert (p_value .to_numpy () - 0.511954 ) < 0.01
50
44
51
- print (f 'Integration tests: Read(pure, active= { active } ) - complete' )
45
+ print ('Integration tests: Read(pure) - complete' )
52
46
53
47
def test_cfa_chunks (self , testdir = TESTDIR ):
54
48
@@ -84,8 +78,14 @@ def test_cfa_chunks(self, testdir=TESTDIR):
84
78
assert p_value .shape == ()
85
79
assert (p_value .to_numpy () - 0.490389 ) < 0.01
86
80
87
- print (f 'Integration tests: Read(chunked) - complete' )
81
+ print ('Integration tests: Read(chunked) - complete' )
88
82
89
83
if __name__ == '__main__' :
90
84
85
+ #import os
86
+ #os.chdir('CFAPyX')
87
+
88
+ TestCFARead ().test_cfa_pure ()
89
+ TestCFARead ().test_cfa_chunks ()
90
+
91
91
print ('Run with poetry run pytest -v -s' )
0 commit comments