-
Notifications
You must be signed in to change notification settings - Fork 16
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
Arxivce 837 repair test cases #323
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
034b7f5
updated expected messaging to include more detail
kyokukou 3e43034
index down from an error test now expects an error
kyokukou bebe609
fixed set cookie calls in tests
kyokukou fac9946
removed quotes around object
kyokukou 4af713d
added mock patch to test
kyokukou fd7ca0e
added another testing option to README
kyokukou 29b2c02
Merge branch 'develop' into ARXIVCE-837-repair-test-cases
kyokukou 8d0a8f2
copy of browse autotesting file
kyokukou 3f17ded
mistake fixes
kyokukou c4c5fcf
specified python version
kyokukou 8347096
startup check not to run during testing
kyokukou ef93be1
Merge pull request #325 from arXiv/adding-autotesting-to-github-workf…
kyokukou 0f1ae33
TESTING now properly treated as boolean
kyokukou 0d78c34
added a tab
kyokukou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10.9" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest poetry | ||
poetry install | ||
#- name: Lint with flake8 | ||
# run: | | ||
# # stop the build if there are Python syntax errors or undefined names | ||
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
poetry run pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
from unittest import TestCase, mock | ||
|
||
from search.factory import create_ui_web_app | ||
|
||
from search.services.index import QueryError | ||
|
||
class TestSearchs(TestCase): | ||
"""Test for the advanced search UI.""" | ||
|
@@ -13,8 +13,10 @@ def setUp(self): | |
self.app = create_ui_web_app() | ||
self.client = self.app.test_client() | ||
|
||
def test_bad_query(self): | ||
@mock.patch("search.controllers.simple.SearchSession") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
def test_bad_query(self, mock_index): | ||
"""Bad query should result in a 400 not a 500. query from ARXIVNG-2437""" | ||
mock_index.search.side_effect = QueryError | ||
response = self.client.get("/?query=%2F%3F&searchtype=all&source=header") | ||
self.assertEqual( | ||
response.status_code, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncomment this flake8 test. When I run this test locally it passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one on line 34. The one on 36 does not yet pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I try to run line 34 locally I get
TypeError: missing_whitespace() takes 1 positional argument but 2 were given
`(search) erin@Erinarxiv:~/arxiv-search$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/erin/.pyenv/versions/3.10.9/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/checker.py", line 82, in _mp_run
).run_checks()
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/checker.py", line 526, in run_checks
self.process_tokens()
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/checker.py", line 511, in process_tokens
self.handle_newline(token_type)
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/checker.py", line 541, in handle_newline
self.run_logical_checks()
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/checker.py", line 448, in run_logical_checks
for offset, text in results:
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/plugins/pycodestyle.py", line 75, in pycodestyle_logical
yield from _missing_whitespace(logical_line, tokens)
TypeError: missing_whitespace() takes 1 positional argument but 2 were given
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/erin/.pyenv/versions/search/bin/flake8", line 8, in
sys.exit(main())
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/main/cli.py", line 23, in main
app.run(argv)
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/main/application.py", line 198, in run
self._run(argv)
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/main/application.py", line 187, in _run
self.run_checks()
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/main/application.py", line 103, in run_checks
self.file_checker_manager.run()
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/checker.py", line 235, in run
self.run_parallel()
File "/home/erin/.pyenv/versions/3.10.9/envs/search/lib/python3.10/site-packages/flake8/checker.py", line 204, in run_parallel
self.results = list(pool.imap_unordered(_mp_run, self.filenames))
File "/home/erin/.pyenv/versions/3.10.9/lib/python3.10/multiprocessing/pool.py", line 873, in next
raise value
TypeError: missing_whitespace() takes 1 positional argument but 2 were given`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, leave that along for now then.