Skip to content

Commit

Permalink
Basic test but actually instantiating the python module
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Lefaudeux authored and blefaudeux committed Oct 2, 2024
1 parent 1fc32e7 commit cab62b4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/gopy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,26 @@ 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 .
- name: Install python module
run: |
ls
python3 -m pip install --user -vvv .
- name: Run the python unit tests
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.Sample.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 cab62b4

Please sign in to comment.