Add FastAPI tests to Pydantic's CI tests (#1075)

fix #1041

* Add test-fastapi.sh script, after failing to create reusable variables in Make

* Add test-fastapi Make target

* Add fastapi dir for tests to gitignore

* Add fastapi tests to Travis

* Update test-fastapi to run the minimum (pytest)

* Move make test-fastapi to normal run, no "Without Deps"

* Install Pydantic without Cython for FastAPI tests

* Put FastAPI tests in its own Travis job

* Add PR changes description

* Remove coverage for FastAPI, it's not relevant for Pydantic

* Implement code review changes, refactor Makefile use and fastapi tests

* Add a bug intentionally, to test that FastAPI tests are using the current source

and make sure it actually breaks CI.

* Fix intentional bug. Confirmed it breaks Travis for FastAPI.
This commit is contained in:
Sebastián Ramírez
2019-12-05 12:35:56 +01:00
committed by Samuel Colvin
parent 890589a610
commit ea709cc66f
5 changed files with 30 additions and 0 deletions
+1
View File
@@ -27,3 +27,4 @@ pydantic/*.so
.auto-format
/sandbox/
/.ghtopdep_cache/
/fastapi/
+6
View File
@@ -93,6 +93,12 @@ jobs:
- make test
env:
- 'DEPS=no'
- stage: test
python: 3.7
name: 'Test FastAPI'
script:
- make test-fastapi
- stage: test
python: 3.7
+8
View File
@@ -88,6 +88,7 @@ clean:
rm -rf site
rm -rf docs/_build
rm -rf docs/.changelog.md docs/.version.md docs/.tmp_schema_mappings.html
rm -rf fastapi/test.db
.PHONY: docs
docs:
@@ -108,3 +109,10 @@ publish: docs
zip -r site.zip site
@curl -H "Content-Type: application/zip" -H "Authorization: Bearer ${NETLIFY}" \
--data-binary "@site.zip" https://api.netlify.com/api/v1/sites/pydantic-docs.netlify.com/deploys
fastapi:
git clone https://github.com/tiangolo/fastapi.git
.PHONY: test-fastapi
test-fastapi: install fastapi
bash tests/test-fastapi.sh
+1
View File
@@ -0,0 +1 @@
Run FastAPI tests during Pydantic's CI tests
+14
View File
@@ -0,0 +1,14 @@
#! /usr/bin/env bash
set -x
set -e
cd fastapi
git fetch --tags
latest_tag_commit=$(git rev-list --tags --max-count=1)
latest_tag=$(git describe --tags "${latest_tag_commit}")
git checkout "${latest_tag}"
pip install -U flit
flit install
PYTHONPATH=./docs/src pytest