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

Slow starting of unit tests #694

Closed
GernotMaier opened this issue Nov 29, 2023 · 3 comments · Fixed by #712
Closed

Slow starting of unit tests #694

GernotMaier opened this issue Nov 29, 2023 · 3 comments · Fixed by #712
Assignees
Labels
2023_maintenance Issues to be fixed in 2023 maintenance

Comments

@GernotMaier
Copy link
Contributor

pytest is very slow to start, even for very simple tests (>5 seconds on my laptop). Very hard to debug with this slow response.

After investigation, it is the same issue as realized recently with general.py (#681): any including of ctapipe means that tools slow down due to a large number of slow imports.

I suggest to consider removing the following two fixtures from conftest.py:

@pytest.fixture
def corsika_histograms_instance(io_handler, corsika_output_file_name):
    return CorsikaHistograms(
        corsika_output_file_name, output_path=io_handler.get_output_directory(dir_type="test")
    )


@pytest.fixture
def corsika_histograms_instance_set_histograms(db, io_handler, corsika_histograms_instance):
    corsika_histograms_instance.set_histograms()
    return corsika_histograms_instance

Victor, is this possible without a huge amount of work?

I will also investigate with ctapipe developers if this is a feature or an issue.

@GernotMaier GernotMaier added the 2023_maintenance Issues to be fixed in 2023 maintenance label Nov 29, 2023
@GernotMaier
Copy link
Contributor Author

See also cta-observatory/ctapipe#2476

@VictorBarbosaMartins
Copy link
Contributor

Hi @GernotMaier. Yes, this should be simple, as the fixtures are likely used in only two different places. I see two options:

  • Either we repeat the definition of the fixture
  • Or we import one test*.py inside the other, which I don't see as a problem, as both are related to corsika histograms.

Should I go for option 2?

@GernotMaier
Copy link
Contributor Author

I leave it to you what is best - less dublication is definitively good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2023_maintenance Issues to be fixed in 2023 maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants