diff --git a/.github/workflows/gopy.yml b/.github/workflows/gopy.yml index 0f244e8..f2694f7 100644 --- a/.github/workflows/gopy.yml +++ b/.github/workflows/gopy.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: "3.11" + python-version: "3.11.10" - name: Install pybindgen run: | @@ -36,8 +36,32 @@ jobs: 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="team@photoroom.com" -url="" -name="datago" -version="0.99" . - ls datago/* + gopy pkg -author="Photoroom" -email="team@photoroom.com" -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/* diff --git a/pyproject.toml b/pyproject.toml index b8a1ca7..1b6f0d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [project] -name = "datago_blefaudeux" +name = "datago" version = "0.0.1" authors = [ { name="Photoroom", email="team@photoroom.com" }, ] -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", diff --git a/python_tests/datago_test.py b/python_tests/datago_test.py new file mode 100644 index 0000000..921312c --- /dev/null +++ b/python_tests/datago_test.py @@ -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__]) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..55b033e --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pytest \ No newline at end of file