Skip to content
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

Faster tango tests #684

Merged
merged 3 commits into from
Dec 9, 2024
Merged

Faster tango tests #684

merged 3 commits into from
Dec 9, 2024

Conversation

jsouter
Copy link
Contributor

@jsouter jsouter commented Nov 29, 2024

Closing #667

Primarily reduces the number of tests by moving parametrized parameters inside the test -> reduces the total number of forks. Am investigating if it's possible to fork after the fixtures are loaded in case we want to retain the nice logging that prints pass/fail per parametrized test.

Also some small QOL changes, using a dataclass to make looping over ATTRIBUTES_SET nicer

@jsouter jsouter linked an issue Nov 29, 2024 that may be closed by this pull request
@evalott100
Copy link
Contributor

As part of this, can we change from using

def pytest_collection_modifyitems(config, items):
tango_dir = "tests/tango"
for item in items:
if tango_dir in str(item.fspath):
item.add_marker(pytest.mark.forked)

to putting an explicit @pytest.mark.forked on the tests (we can remove the @pytest.mark.asyncio).

@jsouter
Copy link
Contributor Author

jsouter commented Dec 2, 2024

As part of this, can we change from using

def pytest_collection_modifyitems(config, items):
tango_dir = "tests/tango"
for item in items:
if tango_dir in str(item.fspath):
item.add_marker(pytest.mark.forked)

to putting an explicit @pytest.mark.forked on the tests (we can remove the @pytest.mark.asyncio).

Yep I like this, potentially makes it easier to unfork specific tests (though currently don't think there are any that can be).

@evalott100
Copy link
Contributor

I'm having much difficulty trying to adjust tango tests to work in 3.12.

I'll wait for this to be merged before I continue trying.

@jsouter
Copy link
Contributor Author

jsouter commented Dec 2, 2024

I'm having much difficulty trying to adjust tango tests to work in 3.12.

I'll wait for this to be merged before I continue trying.

Looks like tests are broken on main for me right now, are you seeing that?

@evalott100
Copy link
Contributor

evalott100 commented Dec 2, 2024

Looks like tests are broken on main for me right now, are you seeing that?

They're broken on main if using 3.12, but they work for me on the other versions?

Edit

Ah nevermind, it's happening on main too... After playing around with it for ages I'm thinking it's best to solve this first:

#681

The error is very elusive.

@jsouter jsouter force-pushed the faster-tango-tests branch from e0f2dba to d83a7eb Compare December 4, 2024 15:28
@jsouter
Copy link
Contributor Author

jsouter commented Dec 5, 2024

@evalott100 looks like pytest-forked is a bit hacked together, and marking the individual tests gives us this error, so may be simplest for me to roll back that last change (see pytest-dev/pytest#9621)

AssertionError: previous item was not torn down properly
===========short test summary info =============
ERROR tests/test_cli.py::test_cli_version - AssertionError: previous item was not torn down properly

@evalott100
Copy link
Contributor

@evalott100 looks like pytest-forked is a bit hacked together, and marking the individual tests gives us this error, so may be simplest for me to roll back that last change

Ah no worries, strange problem.

@jsouter jsouter force-pushed the faster-tango-tests branch from d83a7eb to e7e36f8 Compare December 5, 2024 10:52
@coretl
Copy link
Collaborator

coretl commented Dec 9, 2024

@jsouter should I review this now?

@jsouter jsouter marked this pull request as ready for review December 9, 2024 10:47
@jsouter
Copy link
Contributor Author

jsouter commented Dec 9, 2024

@jsouter should I review this now?

Yep, I think it's in an okay state

@coretl coretl merged commit f7126df into main Dec 9, 2024
22 checks passed
@coretl coretl deleted the faster-tango-tests branch December 9, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the Tango tests faster
3 participants