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

Move fourfront from pytest 2.9 to 3.10 (ALT) #1437

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
d106085
Experiment with updated settings.
netsettler Feb 16, 2021
53ea8b8
Add a few other files that don't need to go into git.
netsettler Feb 17, 2021
2ffb342
Updates to psql-start and kibana-start migrated from cgap.
netsettler Feb 17, 2021
70375ff
Port various utilities from cgap's src/encoded/util.py just to have u…
netsettler Feb 17, 2021
3407507
Use new kibana-start and psql-start scripts to support psql-test and …
netsettler Feb 17, 2021
39393e5
Add extra newline to 13_run_npm.config for parity with cgap-portal diff.
netsettler Feb 17, 2021
56e25b4
Confirm rename.
netsettler Feb 17, 2021
ec3c2cc
Port cgap handling of tilde in setup_eb.py into fourfront.
netsettler Feb 17, 2021
7187013
Port some light refactoring and a bug fix (missing module prefix zipf…
netsettler Feb 17, 2021
2cca870
Add test cases for setup_eb.fix_requirement to test_setup_eb.py
netsettler Feb 17, 2021
effb1a1
Rearrange imports and light PEP8 in src/encoded/root.py
netsettler Feb 17, 2021
5f12ac0
Suppress some noisy deprecation warnings in src/encoded/types/page.py…
netsettler Feb 17, 2021
4966b2d
Port the post_only= argument to load_all and load_all_gen in src/enco…
netsettler Feb 17, 2021
ba95e4f
Use .hash instead of .encrypt in src/encoded/types/access_key.py and …
netsettler Feb 17, 2021
fad2e81
Add a pytest_configure in conftest.py that sets tempfile.tempdir to '…
netsettler Feb 17, 2021
cf4a6c5
Also .hash instead of .encrypt in src/encoded/tests/test_edw_hash.py
netsettler Feb 17, 2021
8dc4b70
Bump versions of awscli, boto3, botocore, netaddr, boto3-stubs.
netsettler Feb 17, 2021
6001cbf
Bump patch version.
netsettler Feb 17, 2021
c0e9317
Make jwt algorithms explicit in src/encoded/authentication.py. Also d…
netsettler Feb 17, 2021
c4bffdd
PyCharm PEP8 hint in src/encoded/dev_servers.py
netsettler Feb 17, 2021
6410658
Use new ACCESSION_PREFIX variable to minimize number of places code d…
netsettler Feb 17, 2021
86ec08c
In conftest.py, change htmltestapp and anonhtmltestapp to pass HTTP_A…
netsettler Feb 17, 2021
22ae5f2
Use dcicutils.misc_utils.TestApp in src/commands/add_date_created.py,…
netsettler Feb 17, 2021
aab5734
Remove an internal import in src/encoded/commands/spreadsheet_to_json.py
netsettler Feb 17, 2021
0552293
Unmark biosample_relation as a fixture. It is not a fixture.
netsettler Feb 17, 2021
22b6902
Port recent tweens work related to mime type selection in src/encoded…
netsettler Feb 17, 2021
d64a698
Port test_renderers.py from cgap-portal.
netsettler Feb 17, 2021
d4e3e83
PEP8
netsettler Feb 17, 2021
bff4eca
Use dcicutils.misc_utils.TestApp in src/encoded/commands/load_access_…
netsettler Feb 17, 2021
c0c1d85
Add a use of set(...) in purge_item_type.py to remove duplicates. Cha…
netsettler Feb 17, 2021
174e191
Backport a TODO comment about {'use_ssl': True} in src/encoded/comman…
netsettler Feb 17, 2021
37a10f5
Merge branch 'master' into kmp_pytest_3.10
netsettler Feb 17, 2021
4ac2485
Rename test_utils.py to test_util.py
netsettler Feb 17, 2021
d667276
Delete test_utils.py because it was renamed to test_util.py
netsettler Feb 17, 2021
659ab9f
Update lock file.
netsettler Feb 17, 2021
3c71f6b
A few more bits of leveling with cgap in test_indexing.py.
netsettler Feb 18, 2021
a918509
Adjust Makefile test case runner to split indexing and non-indexing c…
netsettler Feb 22, 2021
15aab13
Use str in place of basestring in loadxl.py
netsettler Feb 22, 2021
d2965dc
Get workbook from conftest.py and use es_testapp in place of test_app…
netsettler Feb 22, 2021
e900f48
Migrate the es_testapps to here from workbook. Get rid of the unused …
netsettler Feb 22, 2021
0d492f8
Move the definition of ORDER to conftest_settings.py for easier import.
netsettler Feb 22, 2021
615c7a9
Use es_app, which replaces workbook app, in test_aggregation.py
netsettler Feb 22, 2021
712c61b
Use es_testapp instead of workbook's app in test_batch_download.py
netsettler Feb 22, 2021
78e9730
Use es_-style testapps in test_indexing.py
netsettler Feb 22, 2021
ac83546
Use es_-style testapps in test_static_page.py. Also, PEP8 changes and…
netsettler Feb 22, 2021
17561b8
Use str instead of basestring in test_loadxl.py
netsettler Feb 22, 2021
576dbff
Use es_testapp instead of workbook's testapp in test_purge_item_type.py
netsettler Feb 22, 2021
6806e37
Use es_testapp instead of workbook's testapp in test_validation_error…
netsettler Feb 22, 2021
47a6534
Make conftest.py align with cgap-portal.
netsettler Feb 22, 2021
c9b7f29
Adjust a bunch of marks.
netsettler Feb 23, 2021
6d46604
Suppress unwanted warning in test_renderers.py. Mark test_pseudo_run …
netsettler Feb 23, 2021
0cf5885
Repair static page testing to be a better citizen, less sloppy about …
netsettler Feb 23, 2021
75267b5
Make sure to clean up after section page, and other small changes in …
netsettler Feb 23, 2021
a54c22a
Update pyproject to use newer version of dcicutils (0.11.0)
netsettler Feb 23, 2021
23c793d
Don't call master_mixins (a fixture) as a function (in verifier.py)
netsettler Feb 23, 2021
4d65034
Mark the TSV test as just plain broken.
netsettler Feb 24, 2021
2ec7e7f
Hopefully fix test test_page_unique_name.
netsettler Feb 24, 2021
ab02f65
Add a missing import in test_search.py.
netsettler Feb 24, 2021
4337fe6
Generate a better indexer test namespace.
netsettler Feb 24, 2021
4c5ddaf
Adjust what is and is not an indexing test to match cgap.
netsettler Feb 24, 2021
53142cb
Remove some pdb set traces in comments.
netsettler Feb 24, 2021
b457e2f
Wire in a visibly defined set of schema formats. Add some test cases …
netsettler Feb 24, 2021
559c77e
Fix the namespacing used in tests/conftest.py.
netsettler Feb 25, 2021
14b8bad
Merge branch 'master' into kmp_pytest_3.10-alt
netsettler Feb 25, 2021
54194cf
Bump patch version now that master is merged.
netsettler Feb 25, 2021
0cfc702
Use test_auth0.py tester from cgap-portal, since it's much more recen…
netsettler Feb 25, 2021
946299f
Level some library versions. Use new snovault 4.5
netsettler Feb 25, 2021
313f440
Use snovault ^4.5.0 and WebOb ^1.8.7.
netsettler Feb 25, 2021
df9e5ca
Merge branch 'master' into kmp_pytest_3.10-alt
netsettler Feb 25, 2021
94c3552
Uncomment an important import.
netsettler Feb 26, 2021
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
1 change: 1 addition & 0 deletions .ebextensions/13_run_npm.config
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ files:

echo "Finished NPM build in 99_run_npm." >> /var/log/deploy.log
echo "Finished NPM build in 99_run_npm."

echo "Restarting Apache"

sudo service httpd restart
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.coverage
*.srctr*
coverage.xml
beanstalk.cfg
/coverage
Expand All @@ -16,6 +17,7 @@ beanstalk.cfg
/develop-eggs/
/downloads/
/eggs/
/ped_files_data/
/.eggs/
/extends/
/jsconfig.json
Expand Down Expand Up @@ -66,8 +68,17 @@ elasticsearch-*.deb
# Emacs backup files
*~

# PyCharm metadata
.idea/

# Virtual environments
# Conventions vary, including env, venv, or longer names like cgap_env,
# but typically they end in "env".
*env/

# PyCharm
.idea/
# Saved configurations from Elastic beanstalk that have been downloaded.
.elasticbeanstalk/saved_configs/
.elasticbeanstalk/app_versions/

# Used for some kinds of debugging in dcicutils, snovault, cgap & ff.
DEBUGLOG-*
49 changes: 40 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SHELL=/bin/bash

clean: # clear node modules, eggs, npm build stuff
make clean-python-caches
make clean-npm-caches
Expand Down Expand Up @@ -38,7 +40,7 @@ macpoetry-install: # Same as 'poetry install' except that on OSX Catalina, an e

configure: # does any pre-requisite installs
pip install --upgrade pip
pip install poetry==1.0.10 # pinned to avoid build problems we cannot fix in pyproject.toml
pip install poetry==1.1.4 # poetry latest as of 1/25/2021 seemed to work but apparantly does not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is actually out of date now, 1.1.4 is latest and didn't work without the fix-dist-info step, which we now have so we're good.


build: # builds
make configure
Expand Down Expand Up @@ -93,11 +95,17 @@ deploy2: # spins up waittress to serve the application
pserve development.ini

psql-dev: # starts psql with the url after 'sqlalchemy.url =' in development.ini
@psql `grep 'sqlalchemy[.]url =' development.ini | sed -E 's/^.* = (.*)/\1/'`
@scripts/psql-start dev

psql-test: # starts psql with a url constructed from data in 'ps aux'.
@scripts/psql-start test

kibana-start:
kibana-start: # starts a dev version of kibana (default port)
scripts/kibana-start

kibana-start-test: # starts a test version of kibana (port chosen for active tests)
scripts/kibana-start test

kibana-stop:
scripts/kibana-stop

Expand All @@ -112,16 +120,36 @@ clean-python:
pip freeze | xargs pip uninstall -y

test:
bin/test -vv --timeout=200 -m "working and not performance"
make test-npm
make test-unit

retest:
bin/test -vv --last-failed

test-any:
bin/test -vv --timeout=200

test-npm:
bin/test -vv --timeout=200 -m "working and not manual and not integratedx and not performance and not broken and not broken_locally and not sloppy and not indexing"

test-unit:
bin/test -vv --timeout=200 -m "working and not manual and not integratedx and not performance and not broken and not broken_locally and not sloppy and indexing"

test-performance:
bin/test -vv --timeout=200 -m "working and not manual and not integratedx and performance and not broken and not broken_locally and not sloppy"

test-integrated:
bin/test -vv --timeout=200 -m "working and not manual and (integrated or integratedx) and not performance and not broken and not broken_locally and not sloppy"

travis-test: # Actually, we don't normally use this. Instead the GA workflow sets up two parallel tests.
make travis-test-npm
make travis-test-unit

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the changes in this file, and this PR in general, are just leveling with cgap-portal to minimize dissonance. But here we also added some criteria for what to use for make.

Note that in spite of all these markers, I still had to mark tests not to run with skip since otherwise if I try to run the file by name with, for example, bin/test -vv -k test_search it wouldn't confuse me by running things marked broken because I hadn't in my by-hand invocation listed all relevant markers.

The sloppy test is presently marking tests that break stuff because they don't manage side-effects well. It's possible that if they were divvied out differently, like with the indexing tests, it would be OK.

travis-test-npm: # Note this only does the 'not indexing' tests
bin/test -vv --force-flaky --max-runs=3 --timeout=400 -m "working and not performance and not indexing and not action_fail" --aws-auth --durations=10 --cov src/encoded --es search-fourfront-testing-6-8-kncqa2za2r43563rkcmsvgn2fq.us-east-1.es.amazonaws.com:443
bin/test -vv --force-flaky --max-runs=3 --timeout=400 -m "working and not manual and not integratedx and not performance and not broken and not broken_remotely and not sloppy and not indexing" --aws-auth --durations=10 --cov src/encoded --es search-fourfront-testing-6-8-kncqa2za2r43563rkcmsvgn2fq.us-east-1.es.amazonaws.com:443

travis-test-unit: # Note this does the 'indexing' tests
bin/test -vv --force-flaky --max-runs=3 --timeout=400 -m "working and not performance and indexing and not action_fail" --aws-auth --durations=10 --cov src/encoded --es search-fourfront-testing-6-8-kncqa2za2r43563rkcmsvgn2fq.us-east-1.es.amazonaws.com:443
bin/test -vv --force-flaky --max-runs=3 --timeout=400 -m "working and not manual and not integratedx and not performance and not broken and not broken_remotely and not sloppy and indexing" --aws-auth --durations=10 --cov src/encoded --es search-fourfront-testing-6-8-kncqa2za2r43563rkcmsvgn2fq.us-east-1.es.amazonaws.com:443

update: # updates dependencies
poetry update
Expand All @@ -140,11 +168,14 @@ info:
$(info - Use 'make configure' to install poetry. You should not have to do this directly.)
$(info - Use 'make deploy1' to spin up postgres/elasticsearch and load inserts.)
$(info - Use 'make deploy2' to spin up the application server.)
$(info - Use 'make psql-dev' to start psql on data associated with an active 'make deploy1'.)
$(info - Use 'make kibana-start' to start kibana, and 'make kibana-stop' to stop it.)
$(info - Use 'make kibana-start' to start kibana on the default local ES port, and 'make kibana-stop' to stop it.)
$(info - Use 'make kibana-start-test' to start kibana on the port being used for active testing, and 'make kibana-stop' to stop it.)
$(info - Use 'make kill' to kill postgres and elasticsearch proccesses. Please use with care.)
$(info - Use 'make moto-setup' to install moto, for less flaky tests. Implied by 'make build'.)
$(info - Use 'make npm-setup' to build the front-end. Implied by 'make build'.)
$(info - Use 'make test' to run tests with normal options we use on travis ('-m "working and not performance"').)
$(info - Use 'make psql-dev' to start psql on data associated with an active 'make deploy1'.)
$(info - Use 'make psql-test' to start psql on data associated with an active test.)
$(info - Use 'make retest' to run failing tests from the previous test run.)
$(info - Use 'make test' to run tests with normal options similar to what we use on GitHub Actions.)
$(info - Use 'make test-any' to run tests without marker constraints (i.e., with no '-m' option).)
$(info - Use 'make update' to update dependencies (and the lock file).)
9 changes: 9 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import pytest
import tempfile


def pytest_addoption(parser):
parser.addoption("--es", action="store", default="", dest='es',
Expand All @@ -15,3 +17,10 @@ def remote_es(request):
@pytest.fixture(scope='session')
def aws_auth(request):
return request.config.getoption("--aws-auth")


def pytest_configure():
# This adjustment is important to set the default choice of temporary filenames to a nice short name
# because without it some of the filenames we generate end up being too long, and critical functionality
# ends up failing. Some socket-related filenames, for example, seem to have length limits. -kmp 5-Jun-2020
tempfile.tempdir = '/tmp'
Loading