@@ -133,10 +133,11 @@ def tests(session: PowerSession, coverage, pkg_specs):
133133 # session.run2("conda list", env={"CONDA_PREFIX": str(conda_prefix), "CONDA_DEFAULT_ENV": session.get_session_id()})
134134
135135 # Fail if the assumed python version is not the actual one
136- session .run2 ("python ci_tools/check_python_version.py %s" % session .python )
136+ session .run2 (f "python ci_tools/check_python_version.py { session .python } " )
137137
138138 # check that it can be imported even from a different folder
139- # session.run2(['python', '-c', '"import os; os.chdir(\'./docs/\'); import %s"' % pkg_name])
139+ # Important: do not surround the command into double quotes as in the shell !
140+ # session.run('python', '-c', 'import os; os.chdir(\'./docs/\'); import %s' % pkg_name)
140141
141142 # finally run all tests
142143 if not coverage :
@@ -155,20 +156,21 @@ def tests(session: PowerSession, coverage, pkg_specs):
155156 versions_dct = pkg_specs )
156157
157158 # --coverage + junit html reports
158- session .run2 ("coverage run --source src/{pkg_name} "
159- "-m pytest --cache-clear --junitxml={test_xml} --html={test_html} -v tests/"
160- "" .format (pkg_name = pkg_name , test_xml = Folders .test_xml , test_html = Folders .test_html ))
159+ session .run2 (f"coverage run --source src/{ pkg_name } "
160+ f"-m pytest --cache-clear "
161+ f'--junitxml="{ Folders .test_xml } " --html="{ Folders .test_html } " '
162+ f"-v tests/" )
161163 session .run2 ("coverage report" )
162- session .run2 (" coverage xml -o {covxml}" . format ( covxml = Folders .coverage_xml ) )
163- session .run2 (" coverage html -d {dst}" . format ( dst = Folders .coverage_reports ) )
164+ session .run2 (f' coverage xml -o " { Folders .coverage_xml } "' )
165+ session .run2 (f' coverage html -d " { Folders .coverage_reports } "' )
164166 # delete this intermediate file, it is not needed anymore
165167 rm_file (Folders .coverage_intermediate_file )
166168
167169 # --generates the badge for the test results and fail build if less than x% tests pass
168170 nox_logger .info ("Generating badge for tests coverage" )
169171 # Use our own package to generate the badge
170- session .run2 (" genbadge tests -i %s -o %s -t 100" % ( Folders . test_xml , Folders . test_badge ) )
171- session .run2 (" genbadge coverage -i %s -o %s" % ( Folders .coverage_xml , Folders . coverage_badge ) )
172+ session .run2 (f' genbadge tests -i " { Folders . test_xml } " -o " { Folders . test_badge } " -t 100' )
173+ session .run2 (f' genbadge coverage -i " { Folders . coverage_xml } " -o " { Folders .coverage_badge } "' )
172174
173175
174176@power_session (python = PY39 , logsdir = Folders .runlogs )
@@ -188,7 +190,7 @@ def flake8(session: PowerSession):
188190 session .run ("flake8" , pkg_name , "--exit-zero" , "--format=html" , "--htmldir" , str (Folders .flake8_reports ),
189191 "--statistics" , "--tee" , "--output-file" , str (Folders .flake8_intermediate_file ))
190192 # generate our badge
191- session .run2 (" genbadge flake8 -i %s -o %s" % ( Folders .flake8_intermediate_file , Folders . flake8_badge ) )
193+ session .run2 (f' genbadge flake8 -i " { Folders . flake8_intermediate_file } " -o " { Folders .flake8_badge } "' )
192194 rm_file (Folders .flake8_intermediate_file )
193195
194196
@@ -279,10 +281,9 @@ def my_scheme(version_):
279281
280282 # create the github release
281283 session .install_reqs (phase = "release" , phase_reqs = ["click" , "PyGithub" ])
282- session .run2 ("python ci_tools/github_release.py -s {gh_token} "
283- "--repo-slug {gh_org}/{gh_repo} -cf ./docs/changelog.md "
284- "-d https://{gh_org}.github.io/{gh_repo}/changelog {tag}"
285- "" .format (gh_token = gh_token , gh_org = gh_org , gh_repo = gh_repo , tag = current_tag ))
284+ session .run2 (f"python ci_tools/github_release.py -s { gh_token } "
285+ f"--repo-slug { gh_org } /{ gh_repo } -cf ./docs/changelog.md "
286+ f"-d https://{ gh_org } .github.io/{ gh_repo } /changelog { current_tag } " )
286287
287288
288289@nox .session (python = False )
@@ -311,18 +312,18 @@ def gha_list(session):
311312 session_func .parametrize
312313 except AttributeError :
313314 if additional_args .with_version :
314- sessions_list = [{"python" : py , "session" : "%s-%s" % ( session_func .__name__ , py ) } for py in session_func .python ]
315+ sessions_list = [{"python" : py , "session" : f" { session_func .__name__ } - { py } " } for py in session_func .python ]
315316 else :
316- sessions_list = ["%s-%s" % ( session_func .__name__ , py ) for py in session_func .python ]
317+ sessions_list = [f" { session_func .__name__ } - { py } " for py in session_func .python ]
317318 else :
318319 if additional_args .with_version :
319- # sessions_list = [{"python": py, "session": "%s-%s(%s)" % ( session_func.__name__, py, param) }
320+ # sessions_list = [{"python": py, "session": f"{ session_func.__name__}-{py}({ param})" }
320321 # for py, param in product(session_func.python, session_func.parametrize)]
321322 # Hack to return the valid ones only, in order # TODO remove this hack when ENV is removed
322- sessions_list = [{"python" : py , "session" : "%s-%s (env='%s ')" % ( session_func . __name__ , py , env ) }
323+ sessions_list = [{"python" : py , "session" : f" { session_func . __name__ } - { py } (env='{ env } ')" }
323324 for py , env in ENVS .keys ()]
324325 else :
325- sessions_list = ["%s-%s(%s)" % ( session_func .__name__ , py , param )
326+ sessions_list = [f" { session_func .__name__ } - { py } ( { param } )"
326327 for py , param in product (session_func .python , session_func .parametrize )]
327328
328329 # print the list so that it can be caught by GHA.
0 commit comments