Skip to content

Relative imports don't work in pytest-playwright #1585

@frere-jacques

Description

@frere-jacques

I have written a shiny app as a package and use relative imports to load the code from other modules.

This works fine and I can run the app via uvicorn myap.app:app.

However, if I want to run tests with pytest, I get the relative import error. Which is strange, because my app is an actual package.

I assume the reason is that the fixture forces me to give the path to the app.py. I gues the module is then tested as a standalone module and not the project loaded as package.

Another thing I observed is that for shiny express the relative import works for testing, but not for running the app.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions