CircleCI failing to run flask tests that are running locally [on hold]

I’m new to CircleCI. I have a flask app running locally. The tests run succesfully with the following code:

docker-compose up -d
docker-compose run flask bash -c "export FLASK_APP=app; flask test"

Now, I would like to run the same code using CircleCI. Here’s my config.yml.

version: 2
      - image: circleci/python:3.6.8
      - checkout
      - run:
          name: Setup Docker Compose
          command: |
            curl -L`uname -s`-`uname -m` > ~/docker-compose
            chmod +x ~/docker-compose
            sudo mv ~/docker-compose /usr/local/bin/docker-compose
      - setup_remote_docker
      - run:
          name: Run Tests
          command: |
            set -x
            docker-compose up -d
            docker-compose run flask bash -c "export FLASK_APP=app; flask test"

This is giving me the error:

No such command "test".

This means that within the Circle CI Docker container, my flask app with the test function implemented is not found. This seems very strange to me, as what’s inside the Docker container should be the same for both my local environment and the Circle CI environment (that’s the whole point of Docker!).
Am I missing something in config.yml? Am I doing something wrong here?

The test function is defined in of the app as follows:

@click.argument('test_file', required=False)
def test(test_file=None):
    Runs the unit tests without generating a coverage report.
    Enter 'docker-compose run --rm flask python test' to run all the tests in the
    'tests' directory, with no coverage report.
    :return int: 0 if all tests pass, 1 if not
    if test_file:
        pattern = test_file + '.py'
        pattern = 'test*.py'

    tests = unittest.TestLoader().discover('checks_api/tests/unit',
    result = unittest.TextTestRunner(verbosity=2).run(tests)
    if result.wasSuccessful():
        return 0
        return 1

Source: StackOverflow