From d56005d5b987b4e3361e35cd743c2480fb5cf523 Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 13:53:56 -0500 Subject: [PATCH 01/13] odmantic tests --- .github/workflows/third-party.yml | 67 ++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index e72a4286f6f..413ae87a080 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -264,6 +264,69 @@ jobs: # Instead, manually run pytest (we run core and FastAPI tests): run: pytest tests/core tests/fastapi + test-odmantic: + name: Test odmantic (main branch) on Python ${{ matrix.python-version }} + # If 'schedule' was the trigger, don't run it on contributors' forks + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && github.repository == 'pydantic/pydantic') || + (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'third-party-tests')) + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11'] + mongo-version: ['4.4', '5', '6'] + mongo-mode: + - standalone + include: + - python-version: 3.11 + mongo-version: 4.0 + mongo-mode: replicaSet + - python-version: 3.11 + mongo-version: 4.2 + mongo-mode: sharded + + steps: + - name: Checkout odmantic + uses: actions/checkout@v4 + with: + repository: art049/odmantic + + - name: Checkout Pydantic + uses: actions/checkout@v4 + with: + path: pydantic-latest + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: "pyproject.toml" + + - name: Mongo Service + id: mongo-service + uses: art049/mongodb-cluster-action@v0 + with: + version: ${{ matrix.mongo-version }} + mode: ${{ matrix.mongo-mode }} + + - name: Install dependencies + run: | + pip install flit + pip install ".[test]" + - name: Run all tests + run: | + set -e + coverage run -m pytest -v + coverage report -m + coverage xml + env: + TEST_MONGO_URI: ${{ steps.mongo-service.outputs.connection-string }} + TEST_MONGO_MODE: ${{ matrix.mongo-mode }} + create-issue-on-failure: name: Create an issue if tests failed runs-on: ubuntu-latest @@ -273,6 +336,7 @@ jobs: - test-beanie - test-openapi-python-client - test-pandera + - test-odmantic if: | github.repository == 'pydantic/pydantic' && github.event_name == 'schedule' && @@ -281,7 +345,8 @@ jobs: needs.test-sqlmodel.result == 'failure' || needs.test-beanie.result == 'failure' || needs.test-openapi-python-client.result == 'failure' || - needs.test-pandera.result == 'failure' + needs.test-pandera.result == 'failure' || + needs.test-odmantic.result == 'failure' ) permissions: issues: write From 9daad87ffd4fc6593779c9feeac40f7d4a00eaeb Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 13:59:49 -0500 Subject: [PATCH 02/13] egglink pydantic --- .github/workflows/third-party.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 413ae87a080..c7fbdc676f1 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -317,6 +317,7 @@ jobs: run: | pip install flit pip install ".[test]" + pip install -e ./pydantic-latest - name: Run all tests run: | set -e From 8bc66cea98606adc32608299bee39f3e50f93fff Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:03:02 -0500 Subject: [PATCH 03/13] debugging --- .github/workflows/third-party.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index c7fbdc676f1..e3592ff9002 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -320,6 +320,8 @@ jobs: pip install -e ./pydantic-latest - name: Run all tests run: | + pwd + ls set -e coverage run -m pytest -v coverage report -m From d4a105cfb19cf93b353670a1afce8e7b6c42ceb1 Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:08:43 -0500 Subject: [PATCH 04/13] add working directory --- .github/workflows/third-party.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index e3592ff9002..20756b03991 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -319,9 +319,8 @@ jobs: pip install ".[test]" pip install -e ./pydantic-latest - name: Run all tests + working_directory: ./odmantic run: | - pwd - ls set -e coverage run -m pytest -v coverage report -m From 0fc267561e8a01e7a058bcd21ed112be0986e283 Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:13:31 -0500 Subject: [PATCH 05/13] working directory dash --- .github/workflows/third-party.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 20756b03991..779932fc460 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -319,7 +319,7 @@ jobs: pip install ".[test]" pip install -e ./pydantic-latest - name: Run all tests - working_directory: ./odmantic + working-directory: ./odmantic run: | set -e coverage run -m pytest -v From d6732f4dbadf87669942e2f462d56c61bd406683 Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:20:34 -0500 Subject: [PATCH 06/13] just pytesting --- .github/workflows/third-party.yml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 779932fc460..02c74298bf4 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -277,16 +277,6 @@ jobs: fail-fast: false matrix: python-version: ['3.8', '3.9', '3.10', '3.11'] - mongo-version: ['4.4', '5', '6'] - mongo-mode: - - standalone - include: - - python-version: 3.11 - mongo-version: 4.0 - mongo-mode: replicaSet - - python-version: 3.11 - mongo-version: 4.2 - mongo-mode: sharded steps: - name: Checkout odmantic @@ -310,21 +300,20 @@ jobs: id: mongo-service uses: art049/mongodb-cluster-action@v0 with: - version: ${{ matrix.mongo-version }} - mode: ${{ matrix.mongo-mode }} + version: 6 + mode: standalone - name: Install dependencies run: | pip install flit pip install ".[test]" pip install -e ./pydantic-latest + - name: Run all tests working-directory: ./odmantic run: | set -e - coverage run -m pytest -v - coverage report -m - coverage xml + pytest -v env: TEST_MONGO_URI: ${{ steps.mongo-service.outputs.connection-string }} TEST_MONGO_MODE: ${{ matrix.mongo-mode }} From 23db7aa7a3d81895dfba531c09441d1d4661e04a Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:25:25 -0500 Subject: [PATCH 07/13] odmantic dir? --- .github/workflows/third-party.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 02c74298bf4..58c3289c757 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -311,12 +311,10 @@ jobs: - name: Run all tests working-directory: ./odmantic - run: | - set -e - pytest -v + run: pytest tests env: TEST_MONGO_URI: ${{ steps.mongo-service.outputs.connection-string }} - TEST_MONGO_MODE: ${{ matrix.mongo-mode }} + TEST_MONGO_MODE: standalone create-issue-on-failure: name: Create an issue if tests failed From 716005654b01b711d74c4b3234fd704334902131 Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:27:29 -0500 Subject: [PATCH 08/13] debugging --- .github/workflows/third-party.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 58c3289c757..fb31a2ae6e4 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -310,8 +310,9 @@ jobs: pip install -e ./pydantic-latest - name: Run all tests - working-directory: ./odmantic - run: pytest tests + run: | + ls + pytest odmantic/tests env: TEST_MONGO_URI: ${{ steps.mongo-service.outputs.connection-string }} TEST_MONGO_MODE: standalone From 87f9f6157162ab658c64910a3f65681818b1033b Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:29:41 -0500 Subject: [PATCH 09/13] more debugging --- .github/workflows/third-party.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index fb31a2ae6e4..3c275a2858b 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -311,6 +311,8 @@ jobs: - name: Run all tests run: | + ls + cd odmantic ls pytest odmantic/tests env: From be26cf4b2b4af68d34ed608249ffe7ad8b05d6ce Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:32:23 -0500 Subject: [PATCH 10/13] just go back to tests --- .github/workflows/third-party.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 3c275a2858b..a622987ce5d 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -276,7 +276,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout odmantic @@ -310,11 +310,7 @@ jobs: pip install -e ./pydantic-latest - name: Run all tests - run: | - ls - cd odmantic - ls - pytest odmantic/tests + run: pytest tests env: TEST_MONGO_URI: ${{ steps.mongo-service.outputs.connection-string }} TEST_MONGO_MODE: standalone From 1f970b6bea00b09ece15105aa80d1e02bcae98eb Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:48:51 -0500 Subject: [PATCH 11/13] point to sydney's branch --- .github/workflows/third-party.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index a622987ce5d..110dda6638d 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -282,7 +282,8 @@ jobs: - name: Checkout odmantic uses: actions/checkout@v4 with: - repository: art049/odmantic + repository: sydney-runkle/odmantic + ref: fix-model-fields-access - name: Checkout Pydantic uses: actions/checkout@v4 From 67ad290c043f3598665a141862e6527f86103f3b Mon Sep 17 00:00:00 2001 From: sydney-runkle Date: Mon, 30 Dec 2024 14:54:19 -0500 Subject: [PATCH 12/13] don't test on 3.12, odmantic doesn't --- .github/workflows/third-party.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 110dda6638d..95081bd6f51 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -276,7 +276,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - name: Checkout odmantic From 56743c9b9a6f454b7896092649066d162bfa6432 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Tue, 31 Dec 2024 11:19:33 +0100 Subject: [PATCH 13/13] Cleanup --- .github/workflows/third-party.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 95081bd6f51..ec6ee6fa652 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -265,7 +265,7 @@ jobs: run: pytest tests/core tests/fastapi test-odmantic: - name: Test odmantic (main branch) on Python ${{ matrix.python-version }} + name: Test ODMantic (main branch) on Python ${{ matrix.python-version }} # If 'schedule' was the trigger, don't run it on contributors' forks if: | github.event_name == 'workflow_dispatch' || @@ -279,7 +279,7 @@ jobs: python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - - name: Checkout odmantic + - name: Checkout ODMantic uses: actions/checkout@v4 with: repository: sydney-runkle/odmantic @@ -294,23 +294,24 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: pip - cache-dependency-path: "pyproject.toml" - - name: Mongo Service + - name: Mongo service id: mongo-service uses: art049/mongodb-cluster-action@v0 with: version: 6 mode: standalone - - name: Install dependencies + - name: Install ODMantic dependencies run: | - pip install flit pip install ".[test]" + pip uninstall --yes pydantic pip install -e ./pydantic-latest - - name: Run all tests + - name: List installed dependencies + run: pip list + + - name: Run ODMantic tests run: pytest tests env: TEST_MONGO_URI: ${{ steps.mongo-service.outputs.connection-string }}