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

Issues with Pytest and Arel Middleware #33

Closed
y0nei opened this issue Feb 28, 2023 · 3 comments
Closed

Issues with Pytest and Arel Middleware #33

y0nei opened this issue Feb 28, 2023 · 3 comments

Comments

@y0nei
Copy link

y0nei commented Feb 28, 2023

I currently have big issues with running the middleware version of arel and pytest together, i have some Pydantic settings loaded that block arel from being loaded unless an enviroment variable is set (and it also has a default value). Arel loads either way and i dont know how to fix it.

@y0nei
Copy link
Author

y0nei commented Feb 28, 2023

Pytest result from middleware branch:
image
image
Also having an error dump above that

@y0nei
Copy link
Author

y0nei commented Feb 28, 2023

Those are the test im running.

def test_read_post_item():
    response = client.get("/post/1")
    assert response.status_code == status.HTTP_200_OK

def test_read_invalid_post_item():
    response = client.get("/post/-1")
    assert response.status_code == status.HTTP_404_NOT_FOUND

def test_read_post_item_not_int():
    response = client.get("/post/foo")
    assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY

Import functions

def initHotreload(app):
    if settings.DEBUG != 1 or settings.ENVIRONMENT != "development":
        print(">To enable browser hotreloading: set DEBUG to 1",
              "\n>and ENVIRONMENT to development in the .env file")
        return

    try:
        import arel

        # TODO: Read Arel reload dirs to settings
        app.add_middleware(arel.HotReloadMiddleware, paths=[
            arel.Path("posts", on_reload=[reload_data]),
            arel.Path("app/templates")
        ])
    except ImportError:
        print(">Arel could not be successfully imported",
              "\n>Make sure your docker build args match the environment")

@y0nei y0nei changed the title Issues with Pytest and arel Issues with Pytest and Arel Middleware Feb 28, 2023
@florimondmanca
Copy link
Owner

florimondmanca commented Feb 28, 2023

Hi @y0nei

The middleware revamped hasn’t been released or even merged, I can’t provide help on problems encountered on unfinished functionality. For this reason I’m going to close this as I can’t treat this report as an “issue”.

I’d be very pleased if you investigate what in the proposed code causes these issues, though.

For example, comparing with behavior with the currently released version might help.

thanks!

@florimondmanca florimondmanca closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2023
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