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

Running with --test-alembic creates tests in the wrong directory? #77

Closed
jarviliam opened this issue Apr 2, 2023 · 5 comments
Closed

Comments

@jarviliam
Copy link

Thank you for the wonderful plugin and framework for running tests for migrations.

I've installed the plugin with the following project structure:

app/ (application code)
tests/ (tests)

Running pytest alone defaults to running tests in the tests/ folder which is expected. However when I attempt to run it with the --test-alembic flag it doesn't utilize the alembic_engine fixture in tests/conftest.py. Usually when running pytest the tests all run like tests/** but with the above flag the alembic tests runs under app/__init__.py which makes sense why it can't use the fixture. Even when using the pytest_alembic_tests_folder flag it doesn't move the tests.

As a workaround I can just import the tests in a folder under tests/ and run pytest with an alembic marker but I was just wondering why it keeps trying to create the alembic tests in the app/ folder 🤔

@DanCardin
Copy link
Contributor

This sounds like it's the same or similar issue/solution to #69 (comment).

If you're using 0.10.1 cc6076d#diff-29b7bad6b4eb979afb190882fecbca44d0e5b0445087d639b58ab66b2d802397R29, then it may be that your config name is wrong and should be pytest_alembic_tests_path.

fwiw, I would guess that pytest without any path is actually running tests for both app/ and tests/ and you just happen to not have any tests in app/. Which is probably a contributing factor to the problem, although it should certainly work whether app/ is included or not.

@DanCardin
Copy link
Contributor

With that being said, i do see a dangling reference to pytest_alembic_tests_folder in the setup docs, which I appologize if that's what you followed!

@jarviliam
Copy link
Author

jarviliam commented Apr 5, 2023

Thanks for the response, I found out the problem is that 3.10.1 isn't pushed to pypi. I'm running 3.10 locally and it doesn't work but pulling this repo and building as a local package runs fine. I think my issue was fixed with this: #73

Heres the failed action: https://github.com/schireson/pytest-alembic/actions/runs/4236876667/jobs/7362193013

@DanCardin
Copy link
Contributor

How odd! I just pushlished 0.10.1 manually, fwiw

@jarviliam
Copy link
Author

Confirmed its fixed in 0.10.1. Thank you!

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

No branches or pull requests

2 participants