-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Photoroom/ben/run_python_tests
[CI] Install the python module and run python level tests
- Loading branch information
Showing
4 changed files
with
55 additions
and
7 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 |
---|---|---|
|
@@ -28,16 +28,40 @@ jobs: | |
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
python-version: "3.11.10" | ||
|
||
- name: Install pybindgen | ||
run: | | ||
python3 -m pip install pybindgen | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
go install github.com/go-python/gopy@latest | ||
- name: Build | ||
- name: Build python module | ||
run: | | ||
cd src/pkg/client | ||
gopy pkg -author="Photoroom" -email="[email protected]" -url="" -name="datago" -version="0.99" . | ||
ls datago/* | ||
gopy pkg -author="Photoroom" -email="[email protected]" -name="datago" . | ||
export DESTINATION="../../../build" | ||
mkdir -p $DESTINATION/datago | ||
mv datago/* $DESTINATION/datago/. | ||
mv setup.py $DESTINATION/. | ||
mv Makefile $DESTINATION/. | ||
mv README.md $DESTINATION/. | ||
rm LICENSE MANIFEST.in | ||
cd ../../../build | ||
- name: Install python module | ||
run: | | ||
ls | ||
cd build | ||
python3 -m pip install --user -v -e . | ||
- name: Run the python unit tests | ||
env: | ||
DATAROOM_API_KEY: ${{ secrets.DATAROOM_API_KEY }} | ||
DATAROOM_TEST_SOURCE: ${{ secrets.DATAROOM_TEST_SOURCE }} | ||
DATAROOM_API_URL: ${{ secrets.DATAROOM_API_URL }} | ||
|
||
run: | | ||
ls | ||
python3 -m pip install -r requirements.txt | ||
pytest -xv python_tests/* |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[project] | ||
name = "datago_blefaudeux" | ||
name = "datago" | ||
version = "0.0.1" | ||
authors = [ | ||
{ name="Photoroom", email="[email protected]" }, | ||
] | ||
description = "A high performance python module to access data ressources through HTTP, written in Golang" | ||
description = "A high performance dataloader for Python, written in Golang" | ||
readme = "README.md" | ||
requires-python = "==3.11" | ||
requires-python = ">=3.11" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
|
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,23 @@ | ||
from datago import datago | ||
import pytest | ||
import os | ||
|
||
|
||
def get_test_source(): | ||
return os.getenv("DATAROOM_TEST_SOURCE") | ||
|
||
|
||
def test_get_sample(): | ||
# Check that we can instantiate a client and get a sample, nothing more | ||
config = datago.GetDefaultConfig() | ||
config.source = get_test_source() | ||
config.sample = 10 | ||
client = datago.GetClient(config) | ||
data = client.GetSample() | ||
assert data.ID != "" | ||
|
||
|
||
# TODO: Backport all the image correctness tests | ||
|
||
if __name__ == "__main__": | ||
pytest.main(["-v", __file__]) |
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 @@ | ||
pytest |