brainglobe / brainglobe-utils

Shared general purpose tools for the BrainGlobe project
MIT License
11 stars 1 forks source link

Use data path and fixtures consistently #58

Closed K-Meech closed 7 months ago

K-Meech commented 7 months ago

Description

What is this PR

Why is this PR needed? Currently tests don't access the test data directory in a consistent way. For example, many use os.path.join("tests", "data") which means pytest fails when run from any location apart from the top directory.

Also, fixtures aren't consistently used for data generated inside of test modules.

What does this PR do?

This PR creates a data_path fixture inside of tests/tests/conftest.py that can be re-used by all tests. This ensures pytest can be run from any location successfully.

The PR also makes sure that any data generated inside of tests is wrapped into a fixture.

References

None

How has this PR been tested?

All tests pass locally.

Is this a breaking change?

No

Does this PR require an update to the documentation?

No

Checklist:

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.07%. Comparing base (87ca009) to head (830c1d2).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #58 +/- ## ======================================= Coverage 84.07% 84.07% ======================================= Files 35 35 Lines 1331 1331 ======================================= Hits 1119 1119 Misses 212 212 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

K-Meech commented 7 months ago

Ok - all fixed now! Data has been moved to the data folder, + some fixtures changed to parametrize, + I noticed I'd missed the test_pandas/test_pandas_misc file so I updated that to match the rest. @willGraham01 - could you maybe take a quick look, then merge if you're happy with it? Thanks!