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

Swap test file paths to use testdata_base_path #5848

Open
Tracked by #5828
SPPearce opened this issue Jun 19, 2024 · 11 comments
Open
Tracked by #5828

Swap test file paths to use testdata_base_path #5848

SPPearce opened this issue Jun 19, 2024 · 11 comments
Assignees
Labels
tests Related to automated tests

Comments

@SPPearce
Copy link
Contributor

SPPearce commented Jun 19, 2024

In the last few months we have swapped the file paths used in tests from:

file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)

to direct paths like:

file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)

This is in the guidelines now, but could do with a bulk update.

It would be great to have an automatic method to update all the filepaths at once, at least in the nf-test tests (but should be equivalent for pytest I think)
This could do with a linting check too, to ensure that new modules (or pytest -> nf-test conversions) still keep this.

@SPPearce SPPearce changed the title [FEATURE] Swap test file paths to use testdata_base_path Jun 19, 2024
@ewels ewels changed the title Swap test file paths to use testdata_base_path Swap test file paths to use testdata_base_path Jun 19, 2024
@ewels ewels added the tests Related to automated tests label Jun 19, 2024
@GallVp
Copy link
Member

GallVp commented Jul 29, 2024

Hi @SPPearce

I have started this in batches. The first PR is here: #6048

I have created a script to detect and then automatically fix the paths which is available elsewhere:

  1. https://github.com/GallVp/nxf-components/blob/main/.github/check_test_data_paths.sh
  2. https://github.com/GallVp/nxf-components/blob/main/.github/get_test_data_path_update.nf

@SPPearce
Copy link
Contributor Author

Oh thank you @GallVp !
Does it cope with paths specified with either single or double quotes?

@GallVp
Copy link
Member

GallVp commented Jul 29, 2024

Yes, I think it does. It uses single quotes for the updated paths. I'll keep testing it and post updates here.

@GallVp
Copy link
Member

GallVp commented Jul 29, 2024

Oh thank you @GallVp ! Does it cope with paths specified with either single or double quotes?

If you mean params.test_data["xyz"], then the current version does not cope with that: https://github.com/GallVp/nxf-components/blob/6eaf5c8313ddd3d0672c3388cfe981bafb872d70/.github/get_test_data_path_update.nf#L18

Needs an update!

@SPPearce
Copy link
Contributor Author

Yeah, not sure if that is generally used but worth checking.
I have noticed some people put single or double quotes in the new file paths

@SPPearce
Copy link
Contributor Author

I can't see any use of params.test_data["xyz"] with a quick search, so probably don't need to worry about that.

@GallVp

This comment was marked as resolved.

@GallVp

This comment was marked as resolved.

@GallVp

This comment was marked as resolved.

@GallVp

This comment was marked as resolved.

@GallVp
Copy link
Member

GallVp commented Aug 5, 2024

List of modules with issues with their nf-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Related to automated tests
Projects
None yet
Development

No branches or pull requests

3 participants