Following the course "FastAPI-TDD with Docker" I got the project to build and pass locally, then in the github action it fails:
It seems the offensive line in the source is:
response = test_app_with_db.get(f"/summaries/")
and the Github Action result is:
Run docker exec fastapi-tdd python -m flake8 .
docker exec fastapi-tdd python -m flake8 .
shell: /bin/bash -e {0}
env:
IMAGE: docker.pkg.github.com/$GITHUB_REPOSITORY/web
./app/db.py:14:1: E303 too many blank lines (3)
./tests/test_ping.py:4:1: F401 'app.main' imported but unused
./tests/test_summaries.py:6:1: F401 'pytest' imported but unused
./tests/test_summaries.py:60:37: F541 f-string is missing placeholders
##[error]Process completed with exit code 1.
f string work with place holder Example : If you want to put '/summary/' in f string assign it to some variable then put that variable in place holder
Syntax is
f'{variable}'
Example :
f'{"quoted string"}'
I got the error on my when checking my code with flake8. The problem its simply that I was using a f-string for something that could be just a string.
f-string make sense when you insert variables for example:
Correct use of f-string
age = 34
print(f'Hi my name is Enrique and my age is {age} years old')
but if you are just puting a string withou variables then you are making a wrong use of f-string
Incorrect use of f-string
print(f'Hi my name is Enrique and my age is 34 years old')
In that case you don´t need to use the f-string as you are not inserting any variable in your string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With