Skip to content

CIRCLECI-GWP/testing-flask-with-pytest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TESTING FLASK FRAMEWORK WITH PYTEST

CircleCI

The repository contains a RESTful API built with Flask for retrieving books from a list object defined in the API. You can use the following endpoints:

[GET] /bookapi/books/:id - Fetching a single book by its id. [GET] /bookapi/books - Fetching all books

Note: The data is hardcorded to keep the tutorial simple, nothing fancy :)

Installation


python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Running the Application

FLASK_APP=api.py flask run

Execution all the Tests

To execute all the tests, run the following command:

pytest 

Execution all the Tests with stdout response

To execute all the tests, run the following command:

pytest -s

Executing only grouped Tests

To only execute the get_request grouped tests, run the following command:

pytest -m get_request

Details

This repo is built following a tutorial published on CircleCI blog under the CircleCI Guest Writer Program.

About CircleCI Guest Writer Program

Join a team of freelance writers and write about your favorite technology topics for the CircleCI blog. Read more about the program here.

Reviewers: Ron Powell, Stanley Ndagi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages