-
Notifications
You must be signed in to change notification settings - Fork 15
👷 Adjust coverage calculation if a job isn't run and prettify build.yml
#2361
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
Changes from all commits
0647bbd
acef866
7e5b1c3
e9e7b37
91b4c71
2cbbfc9
c75eec4
b353e7b
d85063b
63b1532
cf9e5b7
a75b483
0ed1f6d
4130a08
60a5dbf
91d04fc
721a50a
4012d08
b055c74
7d8ed54
b4e3d7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
__MACOSX/ | ||
|
||
# LaminDB | ||
.coveragerc | ||
*.db | ||
*.lndb | ||
*.jpg | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,38 @@ def install_ci(session, group): | |
) | ||
|
||
|
||
@nox.session | ||
def configure_coverage(session) -> None: | ||
"""Write a coverage config file, adding extra patterns to omit.""" | ||
import tomlkit | ||
|
||
groups_str = session.posargs[0] # first positional argument | ||
|
||
print(groups_str) # for debugging | ||
assert isinstance(groups_str, str) # noqa: S101 so that we don't change this away from string | ||
|
||
if "curator" not in groups_str: | ||
extra_omit_patterns = ["**/curators/*"] | ||
else: | ||
extra_omit_patterns = [] | ||
|
||
# Read patterns from pyproject.toml | ||
base_config_path = Path("pyproject.toml") | ||
with open(base_config_path) as f: | ||
config = tomlkit.load(f) | ||
|
||
# Update the omit patterns | ||
base_patterns = config["tool"]["coverage"]["run"]["omit"] | ||
all_patterns = base_patterns + extra_omit_patterns | ||
config["tool"]["coverage"]["run"]["omit"] = all_patterns | ||
|
||
# Write back to pyproject.toml | ||
with open(base_config_path, "w") as f: | ||
tomlkit.dump(config, f) | ||
|
||
print(base_config_path.read_text()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's needed to check that things worked out the way they're supposed to work. You'll not expand this step in the |
||
|
||
|
||
@nox.session | ||
@nox.parametrize( | ||
"group", | ||
|
@@ -172,7 +204,7 @@ def install_ci(session, group): | |
"cli", | ||
], | ||
) | ||
def build(session, group): | ||
def test(session, group): | ||
import lamindb as ln | ||
|
||
login_testuser2(session) | ||
|
@@ -182,7 +214,7 @@ def build(session, group): | |
if group == "unit-core": | ||
run( | ||
session, | ||
f"pytest {coverage_args} --ignore=tests/core/test_curator.py ./tests/core --durations=50", | ||
f"pytest {coverage_args} ./tests/core --durations=50", | ||
) | ||
elif group == "unit-storage": | ||
run(session, f"pytest {coverage_args} ./tests/storage --durations=50") | ||
|
@@ -210,7 +242,7 @@ def build(session, group): | |
elif group == "curator": | ||
run( | ||
session, | ||
f"pytest {coverage_args} tests/curators/test_curator.py --durations=50", | ||
f"pytest {coverage_args} tests/curators --durations=50", | ||
) | ||
elif group == "cli": | ||
run(session, f"pytest {coverage_args} ./sub/lamin-cli/tests --durations=50") | ||
|
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.
Nit: Should this still be there?
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, we'll need this when we change the group names; this will soon happen as the CI architecture is far from optimal right now.
It's not super intuitive to pass these inputs from the other job around because it's just a long string from the CLI argument. So the easiest is to see it. :)