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

Make test utilities part of the published package API #289

Closed
drdavella opened this issue Feb 20, 2024 · 3 comments · Fixed by #307
Closed

Make test utilities part of the published package API #289

drdavella opened this issue Feb 20, 2024 · 3 comments · Fixed by #307
Assignees
Labels
enhancement New feature or request

Comments

@drdavella
Copy link
Member

Currently classes such as BaseCodemodTest and BaseIntegrationTest are defined within our tests directory which is not part of the published package.

We want to enable external developers to create custom codemod plugins, which means that we should make these test utilities part of the published API.

This means moving these class definitions (and any dependencies) out of the tests directory (which should never be part of the package distribution) and into some kind of utilities module. My initial thought is that they should go somewhere like src/codemodder/codemods/test_utilities/ although maybe there are better options.

This will enable external packages to import things like BaseCodemodTest and use them within their own packages. We should do our best to remove any hard-coded assumptions in these base classes about directory paths, etc.

@drdavella drdavella added the enhancement New feature or request label Feb 20, 2024
@drdavella
Copy link
Member Author

This also means that any test dependencies that are required for the base classes must be moved to actual package dependencies. This doesn't mean we need to include dependencies that are used for specific tests (e.g. flask, django) but it probably means things like GitPython (although I think there's a way to do this without using git that involves temporary directories. But that might be another ticket).

@clavedeluna
Copy link
Contributor

clavedeluna commented Feb 20, 2024

o somewhere like src/codemodder/codemods/test_utilities/ although maybe there are better options.

projects like django and werkzeug have this structure:

repo:
    src/
         test.py
         (or test subdir)
    tests/

We have repo/tests so we probably want src/test so our users can do: from codemodder.test import BaseCodemodTest

@drdavella
Copy link
Member Author

drdavella commented Feb 20, 2024

I don't think it can go under src/test/ but it could go under src/codemodder/test. Otherwise test is going to get published as a top-level package.

I think ideally I'd like it to go under src/codemodder/codemods/test since these tests aren't for the framework itself but rather for individual codemods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants