-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configuring github actions to run on live api (#128)
pytest github actions runs on live APIs #101
- Loading branch information
Showing
54 changed files
with
26,928 additions
and
59,466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Python live API tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.11'] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GBIF_USER: ${{ secrets.GBIF_USER }} | ||
GBIF_PWD: ${{ secrets.GBIF_PWD }} | ||
GBIF_EMAIL: ${{ secrets.GBIF_EMAIL }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install system dependencies | ||
run: | | ||
sudo add-apt-repository ppa:ubuntugis/ppa | ||
sudo apt-get update | ||
sudo apt-get install -y libgeos-c1v5 libgeos-dev | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Delete vcr cassettes so that it runs live tests | ||
run: | | ||
rm -rf test/vcr_cassettes/* | ||
if [ "$(ls -A test/vcr_cassettes)" ]; then | ||
echo "Directory is not empty" | ||
exit 1 | ||
fi | ||
- name: Tests | ||
run: pytest | ||
|
||
- name: Check if vcr cassettes were created today | ||
run: | | ||
for file in test/vcr_cassettes/*; do | ||
file_date=$(stat -c %y "$file" | cut -d ' ' -f 1) | ||
echo "File $file was created on $file_date" | ||
current_date=$(date +%Y-%m-%d) | ||
if [[ "$file_date" != "$current_date" ]]; then | ||
echo "File $file was not created today" | ||
exit 1 | ||
fi | ||
done | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ def caching( | |
requests_cache.install_cache( | ||
cache_name=CACHE_NAME, backend=backend, expire_after=expire_after | ||
) | ||
requests_cache.delete(expired=True) | ||
requests_cache.delete(expired=True)() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jhnwllr
Author
Contributor
|
||
|
||
cache_settings = { | ||
"cache": cache, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
This is not working because there is nothing to call. Why did you add the parentheses?