Skip to content

Commit

Permalink
Merge pull request #14 from Photoroom/ben/run_python_tests
Browse files Browse the repository at this point in the history
[CI] Install the python module and run python level tests
  • Loading branch information
blefaudeux authored Oct 2, 2024
2 parents 1fc32e7 + 965bc93 commit 5a0eb02
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/gopy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
6 changes: 3 additions & 3 deletions pyproject.toml
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",
Expand Down
23 changes: 23 additions & 0 deletions python_tests/datago_test.py
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__])
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest

0 comments on commit 5a0eb02

Please sign in to comment.