Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Use `pytest.ini` and add `pytest-sugar` (#1227)
Dhruv Bhanushali5287a6ca4780
diff --git a/api/Pipfile b/api/Pipfileindex e416d478a..38d589c01 100644--- a/api/Pipfile+++ b/api/Pipfile@@ -16,6 +16,7 @@ remote-pdb = "~=2.1"pook = "~=1.0"pgcli = "~=3.5"freezegun = "~=1.2.2"+pytest-sugar = "~=0.9"[packages]aws-requests-auth = "~=0.4"diff --git a/api/Pipfile.lock b/api/Pipfile.lockindex cb8e46cbe..f50c2f66b 100644--- a/api/Pipfile.lock+++ b/api/Pipfile.lock@@ -1,7 +1,7 @@{"_meta": {"hash": {- "sha256": "84dec3d3a929eb90d428534a087c090ea54dbcae95751eeb8924c7bf67914b21"+ "sha256": "54ff1b875da9311fbc3a8c45f3c0ba3d4f53640220937260ef14c7b00bb40450"},"pipfile-spec": 6,"requires": {@@ -320,7 +320,7 @@"sha256:f8303414c7b03f794347ad062c0516cee0e15f7a612abd0ce1e25caf6ceb47df","sha256:fca62a8301b605b954ad2e9c3666f9d97f63872aa4efcae5492baca2056b74ab"],- "markers": "python_version >= '3.7'",+ "markers": "python_full_version >= '3.7.0'","version": "==3.1.0"},"coreapi": {@@ -493,7 +493,7 @@"sha256:0e2454645dc00517dee4c6de3863411a9c5f1955d013c5fefa29123dadc92f98","sha256:66c4ece2adfe7cc120e2b6a6798a1fd5c777aecf82eec39bb95cef7cfc7ea2b3"],- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' and python_full_version < '4.0.0'",+ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' and python_version < '4'","version": "==7.17.9"},"elasticsearch-dsl": {@@ -1193,7 +1193,7 @@"sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa","sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"],- "markers": "python_version >= '3.7' and python_full_version < '4.0.0'",+ "markers": "python_version >= '3.7' and python_version < '4'","version": "==2.28.2"},"requests-oauthlib": {@@ -1547,6 +1547,14 @@}},"develop": {+ "appnope": {+ "hashes": [+ "sha256:02bd91c4de869fbb1e1c50aafc4098827a7a54ab2f39d9dcba6c9547ed920e24",+ "sha256:265a455292d0bd8a72453494fa24df5a11eb18373a60c7c0430889f22548605e"+ ],+ "markers": "sys_platform == 'darwin'",+ "version": "==0.1.3"+ },"asttokens": {"hashes": ["sha256:4622110b2a6f30b77e1473affaa97e711bc2f07d3f10848420ff1898edbe94f3",@@ -1704,7 +1712,7 @@"sha256:34471d8b60e1f06d174236c4d3cf9590fbf3cff1cc733b28d15cd83672bcd062","sha256:824c743197bbe2104fcc6dce114a4082bf7f7efdebf16683510cb0ec6d8d53d0"],- "markers": "python_version >= '3.7' and python_version < '4.0'",+ "markers": "python_full_version >= '3.7.0' and python_full_version < '4.0.0'","version": "==0.1.4"},"lazy-object-proxy": {@@ -1762,7 +1770,7 @@"sha256:79f37f38ef9fd5206b924ed7a6f382cea7b649b3b56383c47f1906082b7b9015","sha256:c573e2be2c783abae56c5a1486ab716ca96e09d1c3eab56020d1dc680aa57bf8"],- "markers": "python_version >= '3.7' and python_version < '4.0'",+ "markers": "python_full_version >= '3.7.0' and python_full_version < '4.0.0'","version": "==0.4.4"},"openapi-spec-validator": {@@ -1801,7 +1809,7 @@"sha256:5c869d315be50776cc8a993f3af43e0c60dc01506b399643f919034ebf4cdcab","sha256:cdd7b1f9d7d5c8b8d3315dbf5a86b2596053ae845f056f57d97c0eefff84da14"],- "markers": "python_version >= '3.7' and python_version < '4.0'",+ "markers": "python_full_version >= '3.7.0' and python_full_version < '4.0.0'","version": "==0.4.3"},"pendulum": {@@ -1882,7 +1890,7 @@"sha256:23ac5d50538a9a38c8bde05fecb47d0b403ecd0662857a86f886f798563d5b9b","sha256:45ea77a2f7c60418850331366c81cf6b5b9cf4c7fd34616f733c5427e6abbb1f"],- "markers": "python_version >= '3.7'",+ "markers": "python_full_version >= '3.7.0'","version": "==3.0.38"},"psycopg": {@@ -1958,11 +1966,11 @@},"pytest": {"hashes": [- "sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e",- "sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4"+ "sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362",+ "sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"],"index": "pypi",- "version": "==7.2.2"+ "version": "==7.3.1"},"pytest-django": {"hashes": [@@ -1980,6 +1988,14 @@"index": "pypi","version": "==0.11"},+ "pytest-sugar": {+ "hashes": [+ "sha256:8cb5a4e5f8bbcd834622b0235db9e50432f4cbd71fef55b467fe44e43701e062",+ "sha256:f1e74c1abfa55f7241cf7088032b6e378566f16b938f3f08905e2cf4494edd46"+ ],+ "index": "pypi",+ "version": "==0.9.7"+ },"python-dateutil": {"hashes": ["sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86",@@ -2185,6 +2201,14 @@"markers": "python_version >= '3.7'","version": "==0.9.0"},+ "termcolor": {+ "hashes": [+ "sha256:91ddd848e7251200eac969846cbae2dacd7d71c2871e92733289e7e3666f48e7",+ "sha256:dfc8ac3f350788f23b2947b3e6cfa5a53b630b612e6cd8965a015a776020b99a"+ ],+ "markers": "python_version >= '3.7'",+ "version": "==2.2.0"+ },"tomli": {"hashes": ["sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",diff --git a/api/justfile b/api/justfileindex 21687b13f..c67cac41b 100644--- a/api/justfile+++ b/api/justfile@@ -94,11 +94,11 @@ dbshell:# Run API tests inside the Docker containertest *args: wait-up- env DC_USER="opener" just ../exec web ./test/run_test.sh {{ args }}+ env DC_USER="opener" just ../exec web pytest {{ args }}# Run API tests locallytest-local *args:- pipenv run ./test/run_test.sh {{ args }}+ pipenv run pytest {{ args }}# Run smoke test for the API docsdoc-test: wait-updiff --git a/api/pytest.ini b/api/pytest.iniindex 7dda9f78c..c15e85b91 100644--- a/api/pytest.ini+++ b/api/pytest.ini@@ -1,2 +1,8 @@[pytest]DJANGO_SETTINGS_MODULE = catalog.settings++pythonpath = .++filterwarnings=+ ignore:Unverified HTTPS request+ ignore:DateTimeField AccessToken\.expires received a naive datetimediff --git a/api/test/run_test.sh b/api/test/run_test.shdeleted file mode 100755index b7475f838..000000000--- a/api/test/run_test.sh+++ /dev/null@@ -1,28 +0,0 @@-#!/bin/bash--red="\e[31m"-green="\e[32m"-endcol="\e[0m"--# Specify a file as the first argument to restrict the test to that file only.-# ```-# $ ./test/run_test.sh test/audio_integration_test.py-# ```-if [ $# -ge 1 ]; then- TEST_ARG=( "$@" )-else- TEST_ARG=( "test/" )-fi--PYTHONWARNINGS="ignore:Unverified HTTPS request" \-PYTHONPATH=. \-pytest -s --disable-pytest-warnings "${TEST_ARG[@]}"--succeeded=$?-if [[ $succeeded -eq 0 ]]; then- printf "%b:-) All tests passed${endcol}\n" "${green}"-else- printf "\n\n%b:'( Some tests did not pass${endcol}\n" "${red}"- printf "Hint: \`just logs [service]\` will print the Docker logs and may be helpful for debugging.\n\n"-fi-exit $succeededdiff --git a/ingestion_server/Pipfile b/ingestion_server/Pipfileindex 708e81d87..d2daa0aff 100644--- a/ingestion_server/Pipfile+++ b/ingestion_server/Pipfile@@ -8,6 +8,7 @@ ipython = "~=8.11"pycodestyle = "~=2.10"pytest = "~=7.2"pytest-order = "~=1.1"+pytest-sugar = "~=0.9"remote-pdb = "~=2.1"[packages]diff --git a/ingestion_server/Pipfile.lock b/ingestion_server/Pipfile.lockindex dc27e187c..f92b81068 100644--- a/ingestion_server/Pipfile.lock+++ b/ingestion_server/Pipfile.lock@@ -1,7 +1,7 @@{"_meta": {"hash": {- "sha256": "8075b3699b2f1a9a251a4f3d58342a358b535b578f141e5602aafa957fa51932"+ "sha256": "e72ef0724b1d576c372fa30100b55fa4170cfd49f18fc75612aa60303fc64e4d"},"pipfile-spec": 6,"requires": {@@ -142,7 +142,7 @@"sha256:f8303414c7b03f794347ad062c0516cee0e15f7a612abd0ce1e25caf6ceb47df","sha256:fca62a8301b605b954ad2e9c3666f9d97f63872aa4efcae5492baca2056b74ab"],- "markers": "python_version >= '3.7'",+ "markers": "python_full_version >= '3.7.0'","version": "==3.1.0"},"elasticsearch": {@@ -421,6 +421,14 @@}},"develop": {+ "appnope": {+ "hashes": [+ "sha256:02bd91c4de869fbb1e1c50aafc4098827a7a54ab2f39d9dcba6c9547ed920e24",+ "sha256:265a455292d0bd8a72453494fa24df5a11eb18373a60c7c0430889f22548605e"+ ],+ "markers": "sys_platform == 'darwin'",+ "version": "==0.1.3"+ },"asttokens": {"hashes": ["sha256:4622110b2a6f30b77e1473affaa97e711bc2f07d3f10848420ff1898edbe94f3",@@ -542,7 +550,7 @@"sha256:23ac5d50538a9a38c8bde05fecb47d0b403ecd0662857a86f886f798563d5b9b","sha256:45ea77a2f7c60418850331366c81cf6b5b9cf4c7fd34616f733c5427e6abbb1f"],- "markers": "python_version >= '3.7'",+ "markers": "python_full_version >= '3.7.0'","version": "==3.0.38"},"ptyprocess": {@@ -591,6 +599,14 @@"index": "pypi","version": "==1.1.0"},+ "pytest-sugar": {+ "hashes": [+ "sha256:8cb5a4e5f8bbcd834622b0235db9e50432f4cbd71fef55b467fe44e43701e062",+ "sha256:f1e74c1abfa55f7241cf7088032b6e378566f16b938f3f08905e2cf4494edd46"+ ],+ "index": "pypi",+ "version": "==0.9.7"+ },"remote-pdb": {"hashes": ["sha256:2d70c6f41e0eabf0165e8f1be58f82aa7a605aaeab8f2aefeb9ce246431091c1",@@ -614,6 +630,14 @@],"version": "==0.6.2"},+ "termcolor": {+ "hashes": [+ "sha256:91ddd848e7251200eac969846cbae2dacd7d71c2871e92733289e7e3666f48e7",+ "sha256:dfc8ac3f350788f23b2947b3e6cfa5a53b630b612e6cd8965a015a776020b99a"+ ],+ "markers": "python_version >= '3.7'",+ "version": "==2.2.0"+ },"tomli": {"hashes": ["sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",diff --git a/ingestion_server/justfile b/ingestion_server/justfileindex 62bbb439e..ccaecad0d 100644--- a/ingestion_server/justfile+++ b/ingestion_server/justfile@@ -77,4 +77,4 @@ delete model="image" suffix="init" alias="image":# Run ingestion-server tests locallytest-local *args:- pipenv run ./test/run_test.sh {{ args }}+ pipenv run pytest {{ args }}diff --git a/ingestion_server/pytest.ini b/ingestion_server/pytest.ininew file mode 100644index 000000000..3ffe34947--- /dev/null+++ b/ingestion_server/pytest.ini@@ -0,0 +1,5 @@+[pytest]+pythonpath = .++filterwarnings=+ ignore:Unverified HTTPS requestdiff --git a/ingestion_server/test/run_test.sh b/ingestion_server/test/run_test.shdeleted file mode 100755index c92774f64..000000000--- a/ingestion_server/test/run_test.sh+++ /dev/null@@ -1,27 +0,0 @@-#!/bin/bash--red="\e[31m"-green="\e[32m"-endcol="\e[0m"--# Specify a file as the first argument to restrict the test to that file only.-# ```-# $ ./test/run_test.sh test/unit_test.py-# ```-if [ $# -ge 1 ]; then- TEST_ARG=( "$@" )-else- TEST_ARG=( "test/" )-fi--PYTHONWARNINGS="ignore:Unverified HTTPS request" \-PYTHONPATH=. \-pytest -sx -vv --disable-pytest-warnings "${TEST_ARG[@]}"--succeeded=$?-if [[ $succeeded -eq 0 ]]; then- printf "%b:-) All tests passed${endcol}\n" "${green}"-else- printf "\n\n%b:'( Some tests did not pass${endcol}\n" "${red}"-fi-exit $succeeded