-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganising test directories #287
Conversation
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/287/index.html |
a9a405c
to
0e1de19
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #287 +/- ##
==========================================
+ Coverage 92.89% 94.93% +2.03%
==========================================
Files 102 152 +50
Lines 18334 31411 +13077
==========================================
+ Hits 17032 29820 +12788
- Misses 1302 1591 +289
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is excellent!
Given the guarantee for this to introduce conflicts I would like to bring this in asap. I left a remark about one of the utilities coming from conftest, otherwise nothing that needs changing from my side.
loki/build/jit.py
Outdated
pymod = compile_and_load(testname, cwd=str(refpath.parent), use_f90wrap=True, f90wrap_kind_map=_f90wrap_kind_map) | ||
|
||
if modulename: | ||
# modname = '_'.join(s.capitalize() for s in refpath.stem.split('_')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug leftover?
loki/build/jit.py
Outdated
return lib.wrap(modname=name, sources=wrap, builder=builder, kind_map=_f90wrap_kind_map) | ||
|
||
|
||
def generate_identity(refpath, routinename, modulename=None, frontend=OFP): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually use this utility somewhere? The default value for frontend is OFP
(sic!) and codecov doesn't pick up on it being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this does indeed seem obsolete these days. Will remove - good spot!
loki/tests/test_cmake.py
Outdated
@@ -197,7 +195,7 @@ def test_cmake_plan(srcdir, config, cmake_project, loki_install, ecbuild, silent | |||
assert cmake_project.exists() | |||
|
|||
for loki_root in loki_install: | |||
with clean_builddir('test_cmake_plan') as builddir: | |||
with clean_builddir('test_cmake_plan') as builddir: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised pylint didn't pick up on this, but looks like empty white space at the end of the line?
0e1de19
to
739c8c4
Compare
@reuterbal Ok, I pushed the changes as a single top-level commit and then rebased to remove the conflicts. 🤞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me now!
The next step in the repository spring clean (issue #253 ) is to move the test battery inside the actual loki package and reorganise them to move the respective test tests into the appropriate sub-packages (eg.
loki.batch.tests
orloki.transform.tests
.This PR does this for all obvious cases, to get the bulk out of the way, leaving the more subtle cases for later and a potentially more detailed refactoring. Importantly, I have resolved the
tests/conftest.py
and moved all the utilities into the respective sub-packages, to ensure imports for multi-sub-directory testing works.As a result, we can now do cute things like this:
This PR is very invasive, but most of the changes are mechanical file moves and the necessary import changes. I used this opportunity to do a general import clean-up across the test battery, trying to enforce a few common conventions and doing imports mainly from the respective sub-packages (eg.
from loki.expression import symbols as sym
andfrom loki.ir import nodes as ir
. This causes the second source of a large amount of generic line changes.The third set of source changes pertains to the location of the (sometimes shared) raw source files in the test directory. Where necessary, I introduced a fixture
testdir
that points to the root test packageloki.tests
. Eventually we can selectively move some of these into the respective sub-package test directories, but that is beyond this PR.Importantly, I've also not touched the
transformations
sub-package, as the consolidation withloki.transform
will be more subtle in many way. Restructuring and re-integrating that is also left to a follow-on PR.In a little more detail:
pragma_utils
intoloki.ir
loki.tests
conftests.py
and movedavailable_frontends
intoloki.frontend
, the JIT and test-cleaning utilities intoloki.build.jit
and the remainder intoloki.tools.util
loki.ir
,loki.expression
,loki.batch
,loki.frontend
,loki.backend
,loki.build
,loki.analysis
,loki.tools
and, of course,loki.transform
testdir
fixture to point to the root testdir for external source file paths where needed