Skip to content

Commit 2b89eb4

Browse files
committed
cut down default testing time
1 parent c402451 commit 2b89eb4

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

test/test_apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Testing ast_transformer module on FFB-MINI application."""
22

33
import logging
4+
import os
45
import pathlib
56
import platform
67
import unittest
@@ -81,15 +82,19 @@ def _run_app_test(
8182
def test_miranda_io(self):
8283
self._run_app_test('miranda_io')
8384

85+
@unittest.skipUnless(os.environ.get('TEST_LONG'), 'skipping long test')
8486
def test_flash_45(self):
8587
self._run_app_test('FLASH-4.5')
8688

89+
@unittest.skipUnless(os.environ.get('TEST_LONG'), 'skipping long test')
8790
def test_flash_subset(self):
8891
self._run_app_test('FLASH-SUBSET')
8992

93+
@unittest.skipUnless(os.environ.get('TEST_LONG'), 'skipping long test')
9094
def test_ffb_mini(self):
9195
self._run_app_test('FFB-MINI', None, 24)
9296

97+
@unittest.skipUnless(os.environ.get('TEST_LONG'), 'skipping long test')
9398
@unittest.skipIf(platform.system() == 'Windows', 'OFC not available on Windows')
9499
def test_ffb_mini_with_ofc(self):
95100
self._run_app_test('FFB-MINI', None, 35, True)

test/test_parser_wrapper.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@
1616

1717
_HERE = pathlib.Path(__file__).resolve().parent
1818

19+
INPUT_PATH = _HERE.joinpath('examples', 'empty.f')
20+
1921
INPUT_PATHS = list(pathlib.Path(_HERE, 'examples').glob('**/*.*'))
2022
INPUT_PATHS_LARGE = list(pathlib.Path(_HERE, 'examples_large').glob('**/*.*'))
2123
VERBOSITIES = (0, 20, 80, 100)
2224

25+
SOME_INPUT_PATHS = [_HERE.joinpath('examples', _) for _ in ('comments.f', 'strings.f90')]
26+
SOME_INPUT_PATHS_LARGE = [_HERE.joinpath('examples_large', 'ORCHIDEE_grid.f90')]
27+
SOME_VERBOSITIES = (0, 100)
28+
2329

2430
class Tests(unittest.TestCase):
2531

@@ -30,7 +36,6 @@ def test_config_variants(self):
3036
options = java_config['options']
3137
ofp_class = java_config['ofp_class']
3238
ofp_xml_class = java_config['ofp_xml_class']
33-
input_path = pathlib.Path('test', 'examples', 'empty.f')
3439
for classpath, verbosity, invalid_options in itertools.product(
3540
(None, java_config['classpath']), (0, 100, 'invalid'),
3641
([], ['--invalid', 'option'], ['--help', 'true'])):
@@ -50,7 +55,7 @@ def test_config_variants(self):
5055
if output_path is not None:
5156
command += ['--output', str(output_path)]
5257
command += invalid_options
53-
command.append(str(input_path))
58+
command.append(str(INPUT_PATH))
5459

5560
if invalid_options or verbosity == 'invalid' \
5661
or classpath is None and 'CLASSPATH' not in os.environ:
@@ -64,17 +69,16 @@ def test_unset_config(self):
6469
classpath = java_config['classpath']
6570
options = java_config['options']
6671

67-
input_path = pathlib.Path('test', 'examples', 'empty.f')
6872
java_config['classpath'] = None
6973
with tempfile.NamedTemporaryFile() as output_file:
70-
execute_parser(input_path, pathlib.Path(output_file.name))
74+
execute_parser(INPUT_PATH, pathlib.Path(output_file.name))
7175

7276
java_config['classpath'] = classpath
7377
java_config['options'] = options
7478

7579
def test_execute_parser_stdout(self):
76-
for input_path in INPUT_PATHS:
77-
for verbosity in VERBOSITIES:
80+
for input_path in SOME_INPUT_PATHS:
81+
for verbosity in SOME_VERBOSITIES:
7882
with self.subTest(input_path=input_path, verbosity=verbosity):
7983
process = execute_parser(input_path, None, verbosity)
8084
self.assertEqual(process.returncode, 0)
@@ -87,7 +91,8 @@ def test_generate_xml(self):
8791
for input_path in INPUT_PATHS:
8892
for verbosity in VERBOSITIES:
8993
with self.subTest(input_path=input_path, verbosity=verbosity):
90-
output_path = pathlib.Path(results_path, input_path.name + '.xml')
94+
output_path = results_path.joinpath(
95+
'{}.{}.xml'.format(input_path.name, verbosity))
9196
process = execute_parser(input_path, output_path, verbosity)
9297
self.assertEqual(process.returncode, 0, process)
9398
self.assertTrue(output_path.exists())
@@ -99,7 +104,8 @@ def test_generate_xml_large(self):
99104
for input_path in INPUT_PATHS_LARGE:
100105
for verbosity in VERBOSITIES:
101106
with self.subTest(input_path=input_path, verbosity=verbosity):
102-
output_path = pathlib.Path(results_path, input_path.name + '.xml')
107+
output_path = results_path.joinpath(
108+
'{}.{}.xml'.format(input_path.name, verbosity))
103109
process = execute_parser(input_path, output_path, verbosity)
104110
self.assertEqual(process.returncode, 0)
105111
self.assertTrue(output_path.exists())
@@ -114,16 +120,16 @@ def _validate_tree(self, tree):
114120
self.assertGreater(len(file_node), 0)
115121

116122
def test_parse(self):
117-
for input_path in INPUT_PATHS:
118-
for verbosity in VERBOSITIES:
123+
for input_path in SOME_INPUT_PATHS:
124+
for verbosity in SOME_VERBOSITIES:
119125
with self.subTest(input_path=input_path, verbosity=verbosity):
120126
root_node = parse(input_path, verbosity)
121127
self._validate_tree(root_node)
122128

123129
@unittest.skipUnless(os.environ.get('TEST_LONG'), 'skipping long test')
124130
def test_parse_large(self):
125-
for input_path in INPUT_PATHS_LARGE:
126-
for verbosity in VERBOSITIES:
131+
for input_path in SOME_INPUT_PATHS_LARGE:
132+
for verbosity in SOME_VERBOSITIES:
127133
with self.subTest(input_path=input_path, verbosity=verbosity):
128134
root_node = parse(input_path, verbosity)
129135
self._validate_tree(root_node)

test/test_script.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
from open_fortran_parser.config import DEV_DEPENDENCIES_PATH, DEPENDENCIES_PATH
1111
from .test_setup import run_module
1212

13-
INPUT_PATH = pathlib.Path('test', 'examples', 'empty.f')
13+
_HERE = pathlib.Path(__file__).resolve().parent
14+
15+
INPUT_PATH = _HERE.joinpath('examples', 'empty.f')
1416

1517

1618
def normalize_newlines(text: str) -> str:
@@ -36,6 +38,7 @@ def test_help(self):
3638
self.assertIn('usage', text)
3739
self.assertIn('open_fortran_parser', text)
3840

41+
@unittest.skipUnless(os.environ.get('TEST_DEPENDENCIES'), 'skipping dependency test')
3942
def test_deps_flag(self):
4043
sio = io.StringIO()
4144
with contextlib.redirect_stderr(sio):

0 commit comments

Comments
 (0)