Skip to content

Commit f39d6a6

Browse files
committed
test: fix test paddings to pass linter in CI
1 parent 2522490 commit f39d6a6

15 files changed

Lines changed: 138 additions & 140 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ repos:
4343
rev: v5.0.2
4444
hooks:
4545
- id: inifix-format
46+
files: ^(test/).*\.(ini)$ # want to skip pytest.ini
4647

4748
- repo: https://github.com/Lucas-C/pre-commit-hooks
4849
rev: v1.5.5

doc/source/testing/testLauncher.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ By default, the alphabetical order will be used.
302302
When clauses
303303
------------
304304

305-
You can also dynamically override a specific value when a parameter value is selected,
306-
it simplified the writting of some conditions like if you used and IF statement.
305+
You can also dynamically override a specific value when a parameter value is selected.
306+
It is just like if you used and IF statement.
307307

308308
.. code-block:: json
309309
@@ -360,7 +360,6 @@ They are described like :
360360
"dec": [2,2,2],
361361
"multirun": [
362362
{
363-
364363
},{
365364
"mpi": true,
366365
"restart": true,

pytools/idfx_test.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import sys
66
import re
77
import json
8-
import pytest
9-
import warnings
108

119
import numpy as np
1210
import matplotlib.pyplot as plt
@@ -105,11 +103,11 @@ def __init__ (self, current_test_file, name=""):
105103
parser.add_argument("-ccache",
106104
help="Use ccache to reduce the build time over multiple run of the test suite.",
107105
action="store_true")
108-
106+
109107
parser.add_argument("-restart",
110108
help="Enable creating a restart from a checkpoint.",
111109
action='store_true')
112-
110+
113111
parser.add_argument("-v", "--verbose",
114112
help="Enable verbose mode, by not capturing the output.",
115113
action="store_true")
@@ -145,20 +143,20 @@ def __init__ (self, current_test_file, name=""):
145143
self.lastCmakeCmd=""
146144
# subdir
147145
self.filterSubdir=args.subdir
148-
# save
146+
# save
149147
self.cmdArgs = vars(args)
150148
self.cmdArgs.update({
151149
"restart_no_overwrite": [],
152150
})
153151
self.log=[]
154152
# when making a restart we should not overrite those files (will be checked)
155153
self.restart_no_overwrite=[]
156-
154+
157155
# forward args for pytest
158156
if args.verbose:
159-
unknown.append("--capture=no")
157+
unknown.append("--capture=no")
160158
if args.help_pytest:
161-
unknown.append("--help")
159+
unknown.append("--help")
162160
# remaining args
163161
self.remainingArgs=unknown
164162

@@ -178,7 +176,7 @@ def applyConfig(self, config: dict={}):
178176
newArgs = {}
179177
newArgs.update(self.cmdArgs)
180178
newArgs.update(config)
181-
179+
182180
# replace in dict
183181
self.__dict__.update(newArgs)
184182

pytools/idfx_test_gen.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, currentTestFile: str, name: str = ""):
2121
Constructor or the class.
2222
2323
Args:
24-
currentTestFile (str):
24+
currentTestFile (str):
2525
Path the the current python file. Normally you
2626
simply pass __file__ to this parameter.
2727
name (str):
@@ -55,7 +55,7 @@ def genTestConfigs(self, names:str, params, whenClauses = {}) -> list:
5555
# get name ordering list
5656
nameList = names.split(',')
5757

58-
# gen list of complete configs
58+
# gen list of complete configs
5959
all_configs = []
6060
if isinstance(params, dict):
6161
all_configs += self._genOneConfigSeries(names, params)
@@ -64,7 +64,7 @@ def genTestConfigs(self, names:str, params, whenClauses = {}) -> list:
6464
all_configs += self._genOneConfigSeries(names, p)
6565
else:
6666
raise Exception("Should never be called !")
67-
67+
6868
# convert as parametrize with nice name
6969
result = []
7070
for config in all_configs:
@@ -98,7 +98,7 @@ def extractNamingParameters(self, params) -> list:
9898
Args:
9999
params (list|dict):
100100
The list of configuration sets to scan or a single set.
101-
101+
102102
Returns:
103103
The list of names of the variable parameters.
104104
'''
@@ -129,7 +129,7 @@ def extractNamingParameters(self, params) -> list:
129129
# TODO make something better by assigning a priority to vars
130130
variables.sort()
131131

132-
# ok
132+
# ok
133133
return ','.join(variables)
134134

135135
def _genNextLevelCombinations(self, input: list, paramName: str, paramValues: list) -> list:
@@ -139,7 +139,7 @@ def _genNextLevelCombinations(self, input: list, paramName: str, paramValues: li
139139
Args:
140140
input (list):
141141
The incoming list of combinations already unpacked before this call.
142-
paramName (str):
142+
paramName (str):
143143
Name of the parameter to unpack.
144144
paramValues (list):
145145
The list of values to unpack and to build combinations for.

pytools/idfx_test_run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _makeVariableArgAsList(self, namings: str, variants) -> list:
5555
# split namings
5656
namings = namings.split(",")
5757

58-
# loop on each
58+
# loop on each
5959
for variant in variants:
6060
for name in namings:
6161
if name in variant and isinstance(variant[name], list) == False:
@@ -101,10 +101,10 @@ def genTests(self) -> list:
101101
result += idefixTestGenerator.genTestConfigs(namings, test['variants'], test.get('when', {}))
102102
except Exception as e:
103103
raise Exception(f"Fail to generate tests from {testfileRelPath} : {e}")
104-
104+
105105
# ok
106106
return result
107-
107+
108108
def run(self, config: dict) -> None:
109109
# clone before modify to not modity for caller
110110
config = copy.deepcopy(config)
@@ -239,7 +239,7 @@ def main(self, all: bool = False):
239239
sys.argv.append("-all")
240240
idefixTest = tst.idfxTest(self.parentScritFile, name="main")
241241
os.environ["IDEFIX_TEST_FILTER_SUBDIR"] = idefixTest.filterSubdir
242-
242+
243243
if idefixTest.all:
244244
pytest.main(['-v', '--no-header', '--junit-xml=idefix-tests.junit.xml', '--tb=short'] + idefixTest.remainingArgs + [self.parentScritFile])
245245
else:

pytools/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
python_files=test_*.py
2+
python_files="test_*.py"

pytools/tests/test/pb1/testme.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"variants": [
3-
{
4-
"dumpname": "dump.0001.dmp",
5-
"ini": ["idefix.ini","idefix-implicit.ini"],
6-
"noplot": true,
7-
"reconstruction": 2,
8-
"tolerance": 1e-14
9-
}
10-
]
2+
"variants": [
3+
{
4+
"dumpname": "dump.0001.dmp",
5+
"ini": ["idefix.ini","idefix-implicit.ini"],
6+
"noplot": true,
7+
"reconstruction": 2,
8+
"tolerance": 1e-14
9+
}
10+
]
1111
}

pytools/tests/test/pb2/testme.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"variants": [
3-
{
4-
"dumpname": "dump.0001.dmp",
5-
"ini": ["idefix.ini","idefix-implicit.ini"],
6-
"noplot": true,
7-
"reconstruction": 2,
8-
"tolerance": 1e-14
9-
},
10-
{
11-
"dumpname": "dump.0001.dmp",
12-
"ini": ["idefix.ini","idefix-implicit.ini"],
13-
"noplot": false,
14-
"reconstruction": 2,
15-
"tolerance": 1e-14
16-
}
17-
]
2+
"variants": [
3+
{
4+
"dumpname": "dump.0001.dmp",
5+
"ini": ["idefix.ini","idefix-implicit.ini"],
6+
"noplot": true,
7+
"reconstruction": 2,
8+
"tolerance": 1e-14
9+
},
10+
{
11+
"dumpname": "dump.0001.dmp",
12+
"ini": ["idefix.ini","idefix-implicit.ini"],
13+
"noplot": false,
14+
"reconstruction": 2,
15+
"tolerance": 1e-14
16+
}
17+
]
1818
}

pytools/tests/test_idfx_test_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ def test_genTests():
8585
'testname': 'pb2'
8686
}, marks=(), id='pb2-idefix-implicit.ini'
8787
),
88-
]
88+
]

test/Dust/DustEnergy/testme.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"namings": "ini",
3-
"variants": [
4-
{
5-
"dumpname": "dump.0001.dmp",
6-
"ini": ["idefix.ini","idefix-implicit.ini"],
7-
"noplot": true,
8-
"reconstruction": 2,
9-
"tolerance": 0
10-
}
11-
]
2+
"namings": "ini",
3+
"variants": [
4+
{
5+
"dumpname": "dump.0001.dmp",
6+
"ini": ["idefix.ini","idefix-implicit.ini"],
7+
"noplot": true,
8+
"reconstruction": 2,
9+
"tolerance": 0
10+
}
11+
]
1212
}

0 commit comments

Comments
 (0)