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

BUG: run tests in a tempdir, copy needed local files #111

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

ev-br
Copy link
Member

@ev-br ev-br commented Feb 20, 2024

When ready, will fix gh-101

(edited)

scpdt/plugin.py Outdated Show resolved Hide resolved
scpdt/plugin.py Outdated Show resolved Hide resolved
scpdt/plugin.py Show resolved Hide resolved
@ev-br
Copy link
Member Author

ev-br commented Feb 20, 2024

With cda3e8b, gh-101 seems to be gone.
EDIT: gone locally indeed; fails on CI though. A structural problem with test.__file__?

@ev-br ev-br changed the title BUG: plugin: get optionflags from DTConfig BUG: run tests in a tempdir, copy needed local files Feb 20, 2024
@ev-br ev-br added bug Something isn't working pytest-plugin labels Feb 20, 2024
@ev-br
Copy link
Member Author

ev-br commented Feb 20, 2024

Two things I do not understand ATM:

  • the path to local files in test_testmod is clearly wrong. Why does TestLocalFiles pass with the doctest layer?
  • in test_pytest_configuration, who filled the local_resources dict of dt_config?

scpdt/plugin.py Outdated Show resolved Hide resolved
@Sheila-nk
Copy link
Collaborator

Sheila-nk commented Feb 26, 2024

Two things I do not understand ATM:

  • the path to local files in test_testmod is clearly wrong. Why does TestLocalFiles pass with the doctest layer?
  • in test_pytest_configuration, who filled the local_resources dict of dt_config?

I believe the local_resources attribute is updated in the local_file_cases module here: https://github.com/ev-br/scpdt/blob/a79e6465b52a30b57db36dc4fa0ab3820ea08c37/scpdt/tests/local_file_cases.py#L5

However, the local files are typically located in the same directory as the module referencing them so the values should just be the names of the files:

dt_config.local_resources = {'scpdt.tests.local_file_cases.local_files':
                                  ['local_file.txt'],
                            'scpdt.tests.local_file_cases.sio':
                                  ['octave_a.mat']   
                                  }

I pulled this branch locally and this slight change seems to work.

@ev-br
Copy link
Member Author

ev-br commented Feb 26, 2024

Could you send your changes as a PR for the CI to run?

@Sheila-nk
Copy link
Collaborator

Could you send your changes as a PR for the CI to run?

That seems to have done the trick: #127
Can I push the commit to this PR so that I can close the one I just created?

@ev-br
Copy link
Member Author

ev-br commented Feb 26, 2024

Yup sure, if that's more convenient.

@ev-br
Copy link
Member Author

ev-br commented Feb 26, 2024

Yup sure, if that's more convenient.

Actually, I'll cherry-pick it and squash my debug commits.

@Sheila-nk
Copy link
Collaborator

Yup sure, if that's more convenient.

Actually, I'll cherry-pick it and squash my debug commits.

😅 too late

@ev-br
Copy link
Member Author

ev-br commented Feb 26, 2024

OK :-).
Pulled, squashed, and pushed to here. CI is green.

@ev-br ev-br merged commit 27b6521 into main Feb 26, 2024
4 checks passed
@ev-br ev-br deleted the run_after_collection branch February 26, 2024 15:22
@ev-br
Copy link
Member Author

ev-br commented Feb 26, 2024

Merging in. Thank you Sheila for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pytest-plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local files copied to CWD are not deleted after doctesting
2 participants