Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent PRs from breaking Python 3 tests #3345

Merged
merged 4 commits into from
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openlibrary/plugins/worksearch/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
re_to_esc = re.compile(r'[\[\]:]')
re_isbn_field = re.compile(r'^\s*(?:isbn[:\s]*)?([-0-9X]{9,})\s*$', re.I)
re_author_key = re.compile(r'(OL\d+A)')
re_fields = re.compile(r'(-?%s):' % '|'.join(ALL_FIELDS + FIELD_NAME_MAP.keys()), re.I)
re_fields = re.compile(r'(-?%s):' % '|'.join(ALL_FIELDS + list(FIELD_NAME_MAP)), re.I)
re_op = re.compile(' +(OR|AND)$')
re_author_facet = re.compile(r'^(OL\d+A) (.*)$')
re_pre = re.compile(r'<pre>(.*)</pre>', re.S)
Expand Down
66 changes: 21 additions & 45 deletions scripts/test-py3.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,24 @@
#!/bin/sh

pytest openlibrary/mocks openlibrary/olbase openlibrary/utils scripts/tests openlibrary/tests \
openlibrary/catalog/add_book/tests/test_add_book.py \
openlibrary/coverstore/tests/test_code.py \
openlibrary/coverstore/tests/test_webapp.py \
openlibrary/plugins/admin/tests/test_services.py \
openlibrary/plugins/books/tests/test_doctests.py \
openlibrary/plugins/books/tests/test_dynlinks.py \
openlibrary/plugins/importapi/tests/test_code_ils.py \
openlibrary/plugins/importapi/tests/test_import_edition_builder.py \
openlibrary/plugins/openlibrary/tests/test_borrow_home.py \
openlibrary/plugins/openlibrary/tests/test_lists.py \
openlibrary/plugins/openlibrary/tests/test_stats.py \
openlibrary/plugins/upstream/tests/test_account.py \
openlibrary/plugins/upstream/tests/test_addbook.py \
openlibrary/plugins/upstream/tests/test_forms.py \
openlibrary/plugins/upstream/tests/test_merge_authors.py \
openlibrary/plugins/upstream/tests/test_related_carousels.py \
openlibrary/plugins/upstream/tests/test_utils.py \
openlibrary/plugins/worksearch/tests/test_worksearch.py \
openlibrary/catalog/add_book/tests/test_load_book.py \
openlibrary/catalog/add_book/tests/test_match.py \
openlibrary/catalog/marc/tests/test_marc_binary.py \
openlibrary/catalog/marc/tests/test_marc_html.py \
openlibrary/catalog/merge/test_amazon.py \
openlibrary/catalog/merge/test_merge.py \
openlibrary/catalog/merge/test_merge_marc.py \
openlibrary/catalog/merge/test_names.py \
openlibrary/catalog/merge/test_normalize.py

# The following sections allow us to quickly spot tests that are fixed

# catalog: All failing tests run in allow failures (|| true) mode
pytest \
openlibrary/catalog/marc/tests/test_get_subjects.py \
openlibrary/catalog/marc/tests/test_marc.py \
openlibrary/catalog/marc/tests/test_parse.py \
openlibrary/tests/catalog/test_get_ia.py \
|| true

# coverstore: All failing tests run in allow failures (|| true) mode
pytest \
openlibrary/coverstore/tests/test_coverstore.py \
openlibrary/coverstore/tests/test_doctests.py || true

# plugins: All failing tests run in allow failures (|| true) mode
pytest openlibrary/catalog openlibrary/coverstore openlibrary/mocks openlibrary/olbase \
openlibrary/plugins openlibrary/tests openlibrary/utils scripts/tests \
--ignore=openlibrary/catalog/marc/tests/test_get_subjects.py \
--ignore=openlibrary/catalog/marc/tests/test_marc.py \
--ignore=openlibrary/catalog/marc/tests/test_parse.py \
--ignore=openlibrary/tests/catalog/test_get_ia.py \
--ignore=openlibrary/coverstore/tests/test_coverstore.py \
--ignore=openlibrary/coverstore/tests/test_doctests.py \
--ignore=openlibrary/plugins/openlibrary/tests/test_home.py \
--ignore=openlibrary/plugins/upstream/tests/test_merge_authors.py
RETURN_CODE=$?

pytest openlibrary/catalog/marc/tests/test_get_subjects.py || true
pytest openlibrary/catalog/marc/tests/test_marc.py || true
pytest openlibrary/catalog/marc/tests/test_parse.py || true
pytest openlibrary/tests/catalog/test_get_ia.py || true
pytest openlibrary/coverstore/tests/test_coverstore.py || true
pytest openlibrary/coverstore/tests/test_doctests.py || true
pytest openlibrary/plugins/openlibrary/tests/test_home.py || true
pytest openlibrary/plugins/upstream/tests/test_merge_authors.py || true

exit ${RETURN_CODE}