Page MenuHomeSoftware Heritage

Add a 'py3-clientonly' tox environment
AbandonedPublicDraft

Authored by vlorentz on Feb 22 2022, 5:48 PM.

Details

Reviewers
None
Group Reviewers
Reviewers
Summary

To check the CLI and client library can work without any dependency
on Django and friends.

This requires a lot of moving code around.

In particular, I had to move the content of the toplevel conftest.py
to swh/deposit/tests/conftest.py or pytest would error with
ImportPathMismatchError issues when running the py3-clientonly env
(and PY_IGNORE_IMPORTMISMATCH=1 merely replaced this error with other
errors about not finding the fixtures when running tests)

Diff Detail

Repository
rDDEP Push deposit
Branch
validate-metadata
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 27055
Build 42308: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 42307: arc lint + arc unit

Event Timeline

Build has FAILED

Patch application report for D7225 (id=26183)

Could not rebase; Attempt merge onto 55ae87b13c...

Updating 55ae87b1..8528568e
Fast-forward
 conftest.py                                        |  19 --
 requirements-server.txt                            |   1 -
 requirements-test-server.txt                       |   7 +
 requirements-test.txt                              |   7 -
 setup.py                                           |   3 +-
 swh/deposit/api/collection.py                      |   2 +-
 swh/deposit/api/common.py                          |  27 +--
 swh/deposit/api/edit.py                            |   2 +-
 swh/deposit/api/edit_media.py                      |   2 +-
 swh/deposit/api/private/__init__.py                |   3 +-
 swh/deposit/api/private/deposit_check.py           |   2 +-
 swh/deposit/api/private/deposit_read.py            |   3 +-
 swh/deposit/api/private/urls.py                    |   2 +-
 swh/deposit/api/service_document.py                |   2 +-
 swh/deposit/api/sword_edit.py                      |   2 +-
 swh/deposit/api/urls.py                            |  10 +-
 swh/deposit/cli/admin.py                           |   4 +-
 swh/deposit/cli/client.py                          |  26 +-
 swh/deposit/constants.py                           |  35 +++
 swh/deposit/migrations/0018_migrate_swhids.py      |   2 +-
 swh/deposit/models.py                              |   2 +-
 swh/deposit/parsers.py                             |   9 +-
 swh/deposit/tests/api/conftest.py                  |   2 +-
 swh/deposit/tests/api/test_basic_auth.py           |   2 +-
 swh/deposit/tests/api/test_collection.py           |   2 +-
 .../tests/api/test_collection_add_to_origin.py     |   2 +-
 swh/deposit/tests/api/test_collection_list.py      |   6 +-
 swh/deposit/tests/api/test_collection_post_atom.py |   4 +-
 .../tests/api/test_collection_post_binary.py       |   2 +-
 .../tests/api/test_collection_post_multipart.py    |   2 +-
 .../tests/api/test_collection_reuse_slug.py        |   2 +-
 swh/deposit/tests/api/test_delete.py               |   2 +-
 .../tests/api/test_deposit_private_check.py        |   2 +-
 swh/deposit/tests/api/test_deposit_private_list.py |   2 +-
 .../tests/api/test_deposit_private_read_archive.py |   2 +-
 .../api/test_deposit_private_read_metadata.py      |   3 +-
 .../api/test_deposit_private_update_status.py      |   2 +-
 swh/deposit/tests/api/test_deposit_schedule.py     |   2 +-
 swh/deposit/tests/api/test_deposit_state.py        |   2 +-
 swh/deposit/tests/api/test_deposit_update.py       |   2 +-
 swh/deposit/tests/api/test_deposit_update_atom.py  |   4 +-
 .../tests/api/test_deposit_update_binary.py        |   2 +-
 swh/deposit/tests/api/test_get_file.py             |   2 +-
 swh/deposit/tests/api/test_keycloak_auth.py        |   2 +-
 swh/deposit/tests/api/test_service_document.py     |   2 +-
 swh/deposit/tests/{cli => cli-admin}/test_admin.py |  59 ++---
 swh/deposit/tests/cli/conftest.py                  |  12 -
 swh/deposit/tests/cli/test_client.py               |  94 ++++----
 swh/deposit/tests/client/__init__.py               |   0
 swh/deposit/tests/client/data                      |   1 +
 .../tests/{ => client}/test_client_module.py       |   0
 swh/deposit/tests/common.py                        |   4 +-
 swh/deposit/tests/conftest.py                      | 264 +++++++++++----------
 swh/deposit/tests/loader/test_client.py            |   5 +-
 swh/deposit/utils.py                               |  46 +++-
 tox.ini                                            |  14 +-
 56 files changed, 409 insertions(+), 317 deletions(-)
 delete mode 100644 conftest.py
 create mode 100644 requirements-test-server.txt
 create mode 100644 swh/deposit/constants.py
 rename swh/deposit/tests/{cli => cli-admin}/test_admin.py (84%)
 delete mode 100644 swh/deposit/tests/cli/conftest.py
 create mode 100644 swh/deposit/tests/client/__init__.py
 create mode 120000 swh/deposit/tests/client/data
 rename swh/deposit/tests/{ => client}/test_client_module.py (100%)
Changes applied before test
commit 8528568e6429b8035755bdb4d13ceecf0968b41a
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Feb 22 17:48:40 2022 +0100

    Add a 'py3-clientonly' tox environment
    
    To check the CLI and client library can work without any dependency
    on Django and friends.
    
    This requires a lot of moving code around.
    
    In particular, I had to move the content of the toplevel conftest.py
    to swh/deposit/tests/conftest.py or pytest would error with
    ImportPathMismatchError issues when running the py3-clientonly env
    (and PY_IGNORE_IMPORTMISMATCH=1 merely replaced this error with other
    errors about not finding the fixtures when running tests)

commit c6a463e8700bd0694bf0ed1c37c9da38e1cf1bcf
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Feb 22 15:42:32 2022 +0100

    Deduplicate parsing of add_to_origin/create_to_origin + add error logging in the client

Link to build: https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/730/
See console output for more information: https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/730/console

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 22 2022, 5:49 PM
Harbormaster failed remote builds in B27055: Diff 26183!

Do you intend to ensure the python3-swh.deposit* will continue working after such changes?

Note that it'd be great if those refactoring changes could wait after we are done releasing
the future deposit changes about T3677... (i'm aiming at deploying it before the end of the week).

I give up, thanks pytest