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

Unit tests for diff take 25 seconds #829

Closed
dmpetrov opened this issue Jan 18, 2025 · 0 comments · Fixed by #832
Closed

Unit tests for diff take 25 seconds #829

dmpetrov opened this issue Jan 18, 2025 · 0 comments · Fixed by #832
Assignees
Labels
bug Something isn't working

Comments

@dmpetrov
Copy link
Member

Description

Our unit test suite becoming supper slow (lib unit-test time takes 58 seconds!) and useless as a result (now I cannot run it for every change I do - which works just fine before).

We need to reduce it's unit-tests run-time significantly (5-10 times).

I see multiple anti-patterns but I'm sure there are more:

  1. Too many pytest.mark.parametrize

The test below generates 50+ tests without a good reason. For example - there is not need to test save() in diff test - tests have to be "orthogonal". It needs to be replaced by 7-15 smaller tests.

@pytest.mark.parametrize("added", (True, False))
@pytest.mark.parametrize("deleted", (True, False))
@pytest.mark.parametrize("modified", (True, False))
@pytest.mark.parametrize("same", (True, False))
@pytest.mark.parametrize("status_col", ("diff", None))
@pytest.mark.parametrize("save", (True, False))
def test_compare(test_session, added, deleted, modified, same, status_col, save):
    ...
  1. Touching cloud resources

It looks like test_resolve_file() and such require access to clouds.

E               pytest_servers.exceptions.RemoteUnavailable: gs: Failed to setup mock remote: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

Version Info


@dmpetrov dmpetrov added the bug Something isn't working label Jan 18, 2025
@mattseddon mattseddon self-assigned this Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants