Giter Site home page Giter Site logo

Comments (2)

DanCardin avatar DanCardin commented on June 14, 2024

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.

devanubis avatar devanubis commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.