Comments (2)
So it uses the root path of the pytest run to determine where to attach the tests. So for some pytest tests
invocation, it'd end up attaching inside tests/
and load from tests/conftest.py
.
And fwiw, the actual conftest resolution is not handled by pytest-alembic at all, its pure pytest. So I would expect you to see the same fixture resolution behavior for any self-written tests.
Note that if the behavior with the --test-alembic
flag doesnt work for you, you can always just import the tests directly in some test module:
# tests/foo/bar/test_some_file.py
from pytest_alembic.tests import test_model_definitions_match_ddl, ...
This would ensure your tests "register" at whatever location you want in the same way a normally defined test would.
I could perhaps imagine supporting some additional option which lets you customize the path --test-alembic
to attach to a particular location, but I decided not to do that initially because it was fraught with other issues that made the tests resolution unreliable. But if the above doesn't work for you and If you have a compelling usecase, we can talk about what that might look like.
from pytest-alembic.
Ah OK, turns out if I set testpaths
in my pytest settings to my src/
directory everything works a treat without polluting the project root.
Thanks for the help!
from pytest-alembic.
Related Issues (20)
- pytest --test-alembic command fails with pytest 8.1.0 HOT 4
- Repeated migration application HOT 2
- Exclude some migrations by hash HOT 9
- migrate_down_to("base") does not downgrate since v0.10.0 HOT 3
- Bug: during mid-migration check, database has data from latest migration HOT 2
- `test_model_definitions_match_ddl` fails because of an extra mock resource table HOT 2
- Running with `--test-alembic` creates tests in the wrong directory? HOT 5
- Running test_model_definitions_match_ddl() via imports will not show the context HOT 12
- alembic_runner.current does not work with alembic_version in different schema HOT 3
- Consider removing trailing print in runner.py HOT 1
- The fixture gets slower on each revision I create HOT 2
- Adjustments for Compatibility with SQLAlchemy 2.0 and Explicit Transactions HOT 2
- How to integrate with `create_all` fixture HOT 5
- Tests using the same database as pytest_alembic are failing on 0.10.7 HOT 11
- Using "alembic_runner" fixture silences application logs. HOT 2
- Docs update: `compare_type` now defaults to True HOT 1
- Is it possible to override database url for migrations? HOT 3
- Multiple database support HOT 3
- Issues with async tests HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-alembic.