Skip to content

Conversation

@IAlibay
Copy link
Member

@IAlibay IAlibay commented May 23, 2025

Fixes #1298
Fixes #1295
Fixes #1299

It started as just the AHFE protocol, but I thought it'd be better to just move everything.

TODO:

  • MD Protocol tokenization tests.
  • MD Protocol slow tests.

Checklist

  • Added a news entry - internal API only, no news needed

Developers certificate of origin

@codecov
Copy link

codecov bot commented May 23, 2025

Codecov Report

❌ Patch coverage is 53.60000% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.63%. Comparing base (8ade13d) to head (8963fd2).
⚠️ Report is 266 commits behind head on main.

Files with missing lines Patch % Lines
...fe/tests/protocols/openmm_md/test_plain_md_slow.py 16.17% 57 Missing ⚠️
openfe/tests/protocols/conftest.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1294      +/-   ##
==========================================
- Coverage   94.34%   92.63%   -1.71%     
==========================================
  Files         141      143       +2     
  Lines       10868    10957      +89     
==========================================
- Hits        10253    10150     -103     
- Misses        615      807     +192     
Flag Coverage Δ
fast-tests 92.63% <53.60%> (?)
slow-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@IAlibay IAlibay requested a review from atravitz May 23, 2025 18:09
@IAlibay IAlibay changed the title [WIP] Protocols test migration Protocols test migration & MD Protocol simulation tests May 24, 2025
Copy link
Contributor

@hannahbaumann hannahbaumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IAlibay , this looks good to me, maybe we can add a test for the number of frames once that mystery is solved... =)

@IAlibay
Copy link
Member Author

IAlibay commented May 27, 2025

Thanks @IAlibay , this looks good to me, maybe we can add a test for the number of frames once that mystery is solved... =)

Yup, I'm adding this in the follow up PR #1302 :)

Copy link
Contributor

@atravitz atravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as file organization, I'd prefer to have the tests more closely match the code's file structure. so something like:

image

thoughts?
(I can make this commit if you agree)

Copy link
Contributor

@mikemhenry mikemhenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! +1 to @atravitz file layout suggestions

available_platforms,
tmpdir
):
if platform not in available_platforms:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice, eventually we will want to set things up so we can "force" the GPU tests so we can catch issues like the GPU drivers not working BUT for fast tests, I think this is a great idea

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not me unfortunately, there's a good chance this was you from a previous test :P

Comment on lines 34 to 82
class TestPlainMDProtocol(GufeTokenizableTestsMixin):
cls = openmm_md.PlainMDProtocol
key = None
repr = "PlainMDProtocol-"

@pytest.fixture()
def instance(self, protocol):
return protocol

def test_repr(self, instance):
"""
Overwrites the base `test_repr` call to do a bit more.
"""
assert isinstance(repr(instance), str)
assert self.repr in repr(instance)


class TestPlainMDProtocolUnit(GufeTokenizableTestsMixin):
cls = openmm_md.PlainMDProtocolUnit
repr = "PlainMDProtocolUnit("
key = None

@pytest.fixture
def instance(self, protocol_unit):
return protocol_unit

def test_repr(self, instance):
"""
Overwrites the base `test_repr` call to do a bit more.
"""
assert isinstance(repr(instance), str)
assert self.repr in repr(instance)


class TestPlainMDProtocolResult(GufeTokenizableTestsMixin):
cls = openmm_md.PlainMDProtocolResult
key = None
repr = "PlainMDProtocolResult-"

@pytest.fixture()
def instance(self, protocol_result):
return protocol_result

def test_repr(self, instance):
"""
Overwrites the base `test_repr` call to do a bit more.
"""
assert isinstance(repr(instance), str)
assert self.repr in repr(instance) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe take all the duplicated bits and toss it into a class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to raise an issue for this. It feels like we should just upstream the check to gufe if we're overriding the same method everywhere.

@IAlibay
Copy link
Member Author

IAlibay commented May 28, 2025

as far as file organization, I'd prefer to have the tests more closely match the code's file structure. so something like:

thoughts? (I can make this commit if you agree)

So I started with that file structure, but the only "issue" I found was that when you do abfes & ahfes you want to have them as separate folders but code-wise they exist within the one protocols folder. So that structure starts failing really quickly.

@IAlibay
Copy link
Member Author

IAlibay commented May 28, 2025

as far as file organization, I'd prefer to have the tests more closely match the code's file structure. so something like:
thoughts? (I can make this commit if you agree)

So I started with that file structure, but the only "issue" I found was that when you do abfes & ahfes you want to have them as separate folders but code-wise they exist within the one protocols folder. So that structure starts failing really quickly.

Just to follow-up here, assuming we don't really mind being loose with that structure (e.g. for abfes), I'm perfectly happy with that structure @atravitz

@atravitz
Copy link
Contributor

So I started with that file structure, but the only "issue" I found was that when you do abfes & ahfes you want to have them as separate folders but code-wise they exist within the one protocols folder. So that structure starts failing really quickly.

I'm not sure I understand the issue - I'm fine with us adding tests/protocols/openmm_afe/test_abfe_protocol.py etc. - I still think that it's clearer which tests are supposed to cover which pieces of code. But let me know if I'm misunderstanding!

@IAlibay
Copy link
Member Author

IAlibay commented May 28, 2025

So I started with that file structure, but the only "issue" I found was that when you do abfes & ahfes you want to have them as separate folders but code-wise they exist within the one protocols folder. So that structure starts failing really quickly.

I'm not sure I understand the issue - I'm fine with us adding tests/protocols/openmm_afe/test_abfe_protocol.py etc. - I still think that it's clearer which tests are supposed to cover which pieces of code. But let me know if I'm misunderstanding!

To avoid confusion, I would like to have tests/protocols/openmm_abfe and tests/protocols/openmm_ahfe, even though there's only a single protocols/openmm_afe.

@atravitz
Copy link
Contributor

ah okay, i'm fine with that! it still keeps things clear imo. i'll make those changes shortly.

@IAlibay
Copy link
Member Author

IAlibay commented May 28, 2025

ah okay, i'm fine with that! it still keeps things clear imo. i'll make those changes shortly.

Thanks!

@github-actions
Copy link

No API break detected ✅

@IAlibay
Copy link
Member Author

IAlibay commented May 28, 2025

Thanks @atravitz, I just renamed openmm_afe under tests to openmm_ahfe, that way it'll make it easier for when openmm_abfe gets added in #1045

@IAlibay IAlibay merged commit 9533f95 into main May 29, 2025
12 of 13 checks passed
@IAlibay IAlibay deleted the ahfe-test-migration branch May 29, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants