Viewing Pytest output with Docker

  docker, flask, pytest, python

I have a Pytest script I’d like to run on my flask models using Docker. I run my docker instance with

docker-compose up

I then attach to the instance

docker attach my-app-name-here

And then I run my tests

docker exec -it $APP_ID python

There are a bunch of assert statements in my test file but I can’t get any output to the attached container. How can I see my test output in my local terminal/command-line?

Thank you

My test code (part of it for example)

def test_scores_model():
    scores = Scores(1, "7b25a87c-d2c8-49e3-83ac-88dcc1d94902", 4.5, 5.5, 3.5, 2.5, 4.5, 3.5, 0.5, 2.5, 3.5, 1.5, None)
    assert scores.scores_id == 1
    assert scores.session_id == "7b25a87c-d2c8-49e3-83ac-88dcc1d94902"
    assert == 4.5

Source: Docker Questions