From 021ddcd38a601eed20833014a75b29dd7689b4c9 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 22 Jun 2021 22:12:37 +0200 Subject: [PATCH 01/27] removed scm scripts --- Jenkinsfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf44290..88f1a70 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,9 +3,6 @@ pipeline { options { parallelsAlwaysFailFast() } - script { - checkout scm - } stages { stage('BuildAndTest') { matrix { From 329aea2edd39f2f5d95fdb77a85699315c644b4a Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 22 Jun 2021 22:25:06 +0200 Subject: [PATCH 02/27] fixed jenki arguments --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 88f1a70..094a4da 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { stage('build') { agent { docker { image "python:$PY_VERSION" - args '-e DJANGO_SETTINGS_MODULE: "locallibrary.settings"'} + args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'} } steps { sh 'python --version' @@ -26,7 +26,7 @@ pipeline { stage('test') { agent { docker { image "python:$PY_VERSION" - args '-e DJANGO_SETTINGS_MODULE: "locallibrary.settings"'} + args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'} } steps { sh 'pip3 install -r requirements.txt' From 6b33655944f17a299974c8e27a1178f927d1d10e Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 22 Jun 2021 22:58:56 +0200 Subject: [PATCH 03/27] running pip in user space --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 094a4da..4b91092 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'} } steps { - sh 'pip3 install -r requirements.txt' + sh 'pip3 install --user -r requirements.txt' sh 'python -m pytest catalog/tests/' sh 'python -m xmlrunner discover -p *_test.py' } From 048d12cb98fef7952b63ecae9c898b4ecd4e1c73 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 15:06:36 +0200 Subject: [PATCH 04/27] Using global pip for requirements --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4b91092..3117449 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'} } steps { - sh 'pip3 install --user -r requirements.txt' + sh 'pip install -r requirements.txt' sh 'python -m pytest catalog/tests/' sh 'python -m xmlrunner discover -p *_test.py' } From b92fa8f03c59bc86888a364ad7f0046f5ac7136c Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 15:13:30 +0200 Subject: [PATCH 05/27] adding virtual enviros --- Jenkinsfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3117449..38c242f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,9 +29,12 @@ pipeline { args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'} } steps { - sh 'pip install -r requirements.txt' - sh 'python -m pytest catalog/tests/' - sh 'python -m xmlrunner discover -p *_test.py' + sh ''' + cd /tmp/; virtualenv pitestenv; source ./pitestenv/bin/activate + pip install -r requirements.txt; cd - + python -m pytest catalog/tests/ + python -m xmlrunner discover -p *_test.py + ''' } } } From 0764fa0fd12dcf0398db2bb330939bf4675b969d Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 15:24:23 +0200 Subject: [PATCH 06/27] pulling proper venv --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 38c242f..f54e1be 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,8 +30,8 @@ pipeline { } steps { sh ''' - cd /tmp/; virtualenv pitestenv; source ./pitestenv/bin/activate - pip install -r requirements.txt; cd - + python3 -m venv /tmp/pitestenv; source /tmp/pitestenv/bin/activate + pip install -r requirements.txt python -m pytest catalog/tests/ python -m xmlrunner discover -p *_test.py ''' From 18f9b4abf56856787f0b49e3849417ab1af65271 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 15:38:24 +0200 Subject: [PATCH 07/27] trying to run the proper python --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f54e1be..7c53c34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,9 +28,13 @@ pipeline { docker { image "python:$PY_VERSION" args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'} } + environment { + PY_ENV = "/tmp/pitestenv" + } steps { sh ''' - python3 -m venv /tmp/pitestenv; source /tmp/pitestenv/bin/activate + python -m venv ${PY_ENV}; source ${PY_ENV}/bin/activate + export PATH=${PY_ENV}/bin:${PATH} pip install -r requirements.txt python -m pytest catalog/tests/ python -m xmlrunner discover -p *_test.py From 1ee326547217ea68ffc4e249e70241567786eab9 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 15:41:53 +0200 Subject: [PATCH 08/27] removing the python in front --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7c53c34..6004c01 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,11 +33,12 @@ pipeline { } steps { sh ''' - python -m venv ${PY_ENV}; source ${PY_ENV}/bin/activate + python -m venv ${PY_ENV} + source ${PY_ENV}/bin/activate export PATH=${PY_ENV}/bin:${PATH} pip install -r requirements.txt - python -m pytest catalog/tests/ - python -m xmlrunner discover -p *_test.py + pytest catalog/tests/ + xmlrunner discover -p *_test.py ''' } } From 2843489b865733281a3196b2365cbcaee20c3d11 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 16:07:24 +0200 Subject: [PATCH 09/27] running under python manage --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6004c01..51e06f5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { source ${PY_ENV}/bin/activate export PATH=${PY_ENV}/bin:${PATH} pip install -r requirements.txt - pytest catalog/tests/ + python manage.py test xmlrunner discover -p *_test.py ''' } From f4692053ecb44c5f1030c4d4658b2cc9b126b49a Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 16:35:28 +0200 Subject: [PATCH 10/27] DB issue now migrate --- .gitignore | 1 + Jenkinsfile | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5726455..207ddf7 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ var/ *.egg-info/ .installed.cfg *.egg +test-results/ # PyInstaller # Usually these files are written by a python script from a template diff --git a/Jenkinsfile b/Jenkinsfile index 51e06f5..c731690 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,6 +37,7 @@ pipeline { source ${PY_ENV}/bin/activate export PATH=${PY_ENV}/bin:${PATH} pip install -r requirements.txt + python3 manage.py migrate python manage.py test xmlrunner discover -p *_test.py ''' From 20ae400c1471ec1be7d4c9e541009fea83769f78 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 20:46:36 +0200 Subject: [PATCH 11/27] updated to a newer model to fix user error --- .gitignore | 4 + Pipfile | 2 +- Pipfile.lock | 148 +++++++++--------- README.md | 2 +- catalog/admin.py | 2 +- catalog/migrations/0023_auto_20200902_1539.py | 17 -- catalog/models.py | 2 +- catalog/tests/test_models.py | 3 +- catalog/tests/test_views.py | 13 +- locallibrary/settings.py | 4 +- requirements.txt | 22 +-- ...forms.RenewBookFormTest-20200901215420.xml | 33 ---- ..._models.AuthorModelTest-20200901215420.xml | 11 -- ...ws.AuthorCreateViewTest-20200901215420.xml | 17 -- ...iews.AuthorListViewTest-20200901215420.xml | 8 - ...ancesByUserListViewTest-20200901215420.xml | 8 - ...ewBookInstancesViewTest-20200901215420.xml | 13 -- 17 files changed, 96 insertions(+), 213 deletions(-) delete mode 100644 catalog/migrations/0023_auto_20200902_1539.py delete mode 100644 test-results/TEST-catalog.tests.test_forms.RenewBookFormTest-20200901215420.xml delete mode 100644 test-results/TEST-catalog.tests.test_models.AuthorModelTest-20200901215420.xml delete mode 100644 test-results/TEST-catalog.tests.test_views.AuthorCreateViewTest-20200901215420.xml delete mode 100644 test-results/TEST-catalog.tests.test_views.AuthorListViewTest-20200901215420.xml delete mode 100644 test-results/TEST-catalog.tests.test_views.LoanedBookInstancesByUserListViewTest-20200901215420.xml delete mode 100644 test-results/TEST-catalog.tests.test_views.RenewBookInstancesViewTest-20200901215420.xml diff --git a/.gitignore b/.gitignore index 207ddf7..0d2271e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,8 +34,12 @@ var/ *.egg-info/ .installed.cfg *.egg + +# Test reports +test-reports/ test-results/ + # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. diff --git a/Pipfile b/Pipfile index 7c9ee13..fce02df 100644 --- a/Pipfile +++ b/Pipfile @@ -10,7 +10,7 @@ name = "pypi" dj-database-url = "*" django = "*" gunicorn = "*" -"psycopg2" = "*" +psycopg2-binary = "*" whitenoise = "*" unittest-xml-reporting = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 1e4df48..38a3e0e 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,20 +1,7 @@ { "_meta": { "hash": { - "sha256": "fed1293db1dad173865419f29f284b5f0185dcfbe26f951c787764ed3ba3283d" - }, - "host-environment-markers": { - "implementation_name": "cpython", - "implementation_version": "3.6.4", - "os_name": "posix", - "platform_machine": "x86_64", - "platform_python_implementation": "CPython", - "platform_release": "17.3.0", - "platform_system": "Darwin", - "platform_version": "Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64", - "python_full_version": "3.6.4", - "python_version": "3.6", - "sys_platform": "darwin" + "sha256": "d8bc15b0fcfae551aad22aa06ec01bab9a2968b5afea30c02809a8184f33cc36" }, "pipfile-spec": 6, "requires": {}, @@ -27,97 +14,106 @@ ] }, "default": { + "asgiref": { + "hashes": [ + "sha256:7e51911ee147dd685c3c8b805c0ad0cb58d360987b56953878f8c06d2d1c6f1a", + "sha256:9fc6fb5d39b8af147ba40765234fa822b39818b12cc80b35ad9b0cef3a476aed" + ], + "markers": "python_version >= '3.5'", + "version": "==3.2.10" + }, "dj-database-url": { "hashes": [ - "sha256:e16d94c382ea0564c48038fa7fe8d9c890ef1ab1a8ec4cb48e732c124b9482fd", - "sha256:a6832d8445ee9d788c5baa48aef8130bf61fdc442f7d9a548424d25cd85c9f08" + "sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163", + "sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9" ], - "version": "==0.4.2" + "index": "pypi", + "version": "==0.5.0" }, "django": { "hashes": [ - "sha256:52475f607c92035d4ac8fee284f56213065a4a6b25ed43f7e39df0e576e69e9f", - "sha256:d96b804be412a5125a594023ec524a2010a6ffa4d408e5482ab6ff3cb97ec12f" + "sha256:59c8125ca873ed3bdae9c12b146fbbd6ed8d0f743e4cf5f5817af50c51f1fc2f", + "sha256:b5fbb818e751f660fa2d576d9f40c34a4c615c8b48dd383f5216e609f383371f" ], - "version": "==2.0.1" + "index": "pypi", + "version": "==3.1.1" }, "gunicorn": { "hashes": [ - "sha256:75af03c99389535f218cc596c7de74df4763803f7b63eb09d77e92b3956b36c6", - "sha256:eee1169f0ca667be05db3351a0960765620dad53f53434262ff8901b68a1b622" + "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626", + "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c" ], - "version": "==19.7.1" + "index": "pypi", + "version": "==20.0.4" }, - "psycopg2": { + "psycopg2-binary": { "hashes": [ - "sha256:594aa9a095de16614f703d759e10c018bdffeafce2921b8e80a0e8a0ebbc12e5", - "sha256:1cf5d84290c771eeecb734abe2c6c3120e9837eb12f99474141a862b9061ac51", - "sha256:0344b181e1aea37a58c218ccb0f0f771295de9aa25a625ed076e6996c6530f9e", - "sha256:25250867a4cd1510fb755ef9cb38da3065def999d8e92c44e49a39b9b76bc893", - "sha256:317612d5d0ca4a9f7e42afb2add69b10be360784d21ce4ecfbca19f1f5eadf43", - "sha256:9d6266348b15b4a48623bf4d3e50445d8e581da413644f365805b321703d0fac", - "sha256:ddca39cc55877653b5fcf59976d073e3d58c7c406ef54ae8e61ddf8782867182", - "sha256:988d2ec7560d42ef0ac34b3b97aad14c4f068792f00e1524fa1d3749fe4e4b64", - "sha256:7a9c6c62e6e05df5406e9b5235c31c376a22620ef26715a663cee57083b3c2ea", - "sha256:7a75565181e75ba0b9fb174b58172bf6ea9b4331631cfe7bafff03f3641f5d73", - "sha256:94e4128ba1ea56f02522fffac65520091a9de3f5c00da31539e085e13db4771b", - "sha256:92179bd68c2efe72924a99b6745a9172471931fc296f9bfdf9645b75eebd6344", - "sha256:b9358e203168fef7bfe9f430afaed3a2a624717a1d19c7afa7dfcbd76e3cd95c", - "sha256:009e0bc09a57dbef4b601cb8b46a2abad51f5274c8be4bba276ff2884cd4cc53", - "sha256:d3ac07240e2304181ffdb13c099840b5eb555efc7be9344503c0c03aa681de79", - "sha256:40fa5630cd7d237cd93c4d4b64b9e5ed9273d1cfce55241c7f9066f5db70629d", - "sha256:6c2f1a76a9ebd9ecf7825b9e20860139ca502c2bf1beabf6accf6c9e66a7e0c3", - "sha256:37f54452c7787dbdc0a634ca9773362b91709917f0b365ed14b831f03cbd34ba", - "sha256:8f5942a4daf1ffac42109dc4a72f786af4baa4fa702ede1d7c57b4b696c2e7d6", - "sha256:bf708455cd1e9fa96c05126e89a0c59b200d086c7df7bbafc7d9be769e4149a3", - "sha256:82c40ea3ac1555e0462803380609fbe8b26f52620f3d4f8eb480cfd8ceed8a14", - "sha256:207ba4f9125a0a4200691e82d5eee7ea1485708eabe99a07fc7f08696fae62f4", - "sha256:0cd4c848f0e9d805d531e44973c8f48962e20eb7fc0edac3db4f9dbf9ed5ab82", - "sha256:57baf63aeb2965ca4b52613ce78e968b6d2bde700c97f6a7e8c6c236b51ab83e", - "sha256:2954557393cfc9a5c11a5199c7a78cd9c0c793a047552d27b1636da50d013916", - "sha256:7c31dade89634807196a6b20ced831fbd5bec8a21c4e458ea950c9102c3aa96f", - "sha256:1286dd16d0e46d59fa54582725986704a7a3f3d9aca6c5902a7eceb10c60cb7e", - "sha256:697ff63bc5451e0b0db48ad205151123d25683b3754198be7ab5fcb44334e519", - "sha256:fc993c9331d91766d54757bbc70231e29d5ceb2d1ac08b1570feaa0c38ab9582", - "sha256:9d64fed2681552ed642e9c0cc831a9e95ab91de72b47d0cb68b5bf506ba88647", - "sha256:5c3213be557d0468f9df8fe2487eaf2990d9799202c5ff5cb8d394d09fad9b2a" + "sha256:0deac2af1a587ae12836aa07970f5cb91964f05a7c6cdb69d8425ff4c15d4e2c", + "sha256:0e4dc3d5996760104746e6cfcdb519d9d2cd27c738296525d5867ea695774e67", + "sha256:11b9c0ebce097180129e422379b824ae21c8f2a6596b159c7659e2e5a00e1aa0", + "sha256:1fabed9ea2acc4efe4671b92c669a213db744d2af8a9fc5d69a8e9bc14b7a9db", + "sha256:2dac98e85565d5688e8ab7bdea5446674a83a3945a8f416ad0110018d1501b94", + "sha256:42ec1035841b389e8cc3692277a0bd81cdfe0b65d575a2c8862cec7a80e62e52", + "sha256:6a32f3a4cb2f6e1a0b15215f448e8ce2da192fd4ff35084d80d5e39da683e79b", + "sha256:7312e931b90fe14f925729cde58022f5d034241918a5c4f9797cac62f6b3a9dd", + "sha256:7d92a09b788cbb1aec325af5fcba9fed7203897bbd9269d5691bb1e3bce29550", + "sha256:833709a5c66ca52f1d21d41865a637223b368c0ee76ea54ca5bad6f2526c7679", + "sha256:8cd0fb36c7412996859cb4606a35969dd01f4ea34d9812a141cd920c3b18be77", + "sha256:950bc22bb56ee6ff142a2cb9ee980b571dd0912b0334aa3fe0fe3788d860bea2", + "sha256:a0c50db33c32594305b0ef9abc0cb7db13de7621d2cadf8392a1d9b3c437ef77", + "sha256:a0eb43a07386c3f1f1ebb4dc7aafb13f67188eab896e7397aa1ee95a9c884eb2", + "sha256:aaa4213c862f0ef00022751161df35804127b78adf4a2755b9f991a507e425fd", + "sha256:ac0c682111fbf404525dfc0f18a8b5f11be52657d4f96e9fcb75daf4f3984859", + "sha256:ad20d2eb875aaa1ea6d0f2916949f5c08a19c74d05b16ce6ebf6d24f2c9f75d1", + "sha256:b4afc542c0ac0db720cf516dd20c0846f71c248d2b3d21013aa0d4ef9c71ca25", + "sha256:b8a3715b3c4e604bcc94c90a825cd7f5635417453b253499664f784fc4da0152", + "sha256:ba28584e6bca48c59eecbf7efb1576ca214b47f05194646b081717fa628dfddf", + "sha256:ba381aec3a5dc29634f20692349d73f2d21f17653bda1decf0b52b11d694541f", + "sha256:bd1be66dde2b82f80afb9459fc618216753f67109b859a361cf7def5c7968729", + "sha256:c2507d796fca339c8fb03216364cca68d87e037c1f774977c8fc377627d01c71", + "sha256:cec7e622ebc545dbb4564e483dd20e4e404da17ae07e06f3e780b2dacd5cee66", + "sha256:d14b140a4439d816e3b1229a4a525df917d6ea22a0771a2a78332273fd9528a4", + "sha256:d1b4ab59e02d9008efe10ceabd0b31e79519da6fb67f7d8e8977118832d0f449", + "sha256:d5227b229005a696cc67676e24c214740efd90b148de5733419ac9aaba3773da", + "sha256:e1f57aa70d3f7cc6947fd88636a481638263ba04a742b4a37dd25c373e41491a", + "sha256:e74a55f6bad0e7d3968399deb50f61f4db1926acf4a6d83beaaa7df986f48b1c", + "sha256:e82aba2188b9ba309fd8e271702bd0d0fc9148ae3150532bbb474f4590039ffb", + "sha256:ee69dad2c7155756ad114c02db06002f4cded41132cc51378e57aad79cc8e4f4", + "sha256:f5ab93a2cb2d8338b1674be43b442a7f544a0971da062a5da774ed40587f18f5" ], - "version": "==2.7.3.2" + "index": "pypi", + "version": "==2.8.6" }, "pytz": { "hashes": [ - "sha256:80af0f3008046b9975242012a985f04c5df1f01eed4ec1633d56cc47a75a6a48", - "sha256:feb2365914948b8620347784b6b6da356f31c9d03560259070b2f30cff3d469d", - "sha256:59707844a9825589878236ff2f4e0dc9958511b7ffaae94dc615da07d4a68d33", - "sha256:d0ef5ef55ed3d37854320d4926b04a4cb42a2e88f71da9ddfdacfde8e364f027", - "sha256:c41c62827ce9cafacd6f2f7018e4f83a6f1986e87bfd000b8cfbd4ab5da95f1a", - "sha256:8cc90340159b5d7ced6f2ba77694d946fc975b09f1a51d93f3ce3bb399396f94", - "sha256:dd2e4ca6ce3785c8dd342d1853dd9052b19290d5bf66060846e5dc6b8d6667f7", - "sha256:699d18a2a56f19ee5698ab1123bbcc1d269d061996aeb1eda6d89248d3542b82", - "sha256:fae4cffc040921b8a2d60c6cf0b5d662c1190fe54d718271db4eb17d44a185b7" + "sha256:a494d53b6d39c3c6e44c3bec237336e14305e4f29bbf800b599253057fbb79ed", + "sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048" ], - "version": "==2017.3" + "version": "==2020.1" }, - "six": { + "sqlparse": { "hashes": [ - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" + "sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e", + "sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548" ], - "version": "==1.11.0" + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==0.3.1" }, "unittest-xml-reporting": { "hashes": [ - "sha256:28ff367b13073e307ded09deb5351ec4037724c1fd28c9c351f4094723ae27c9", - "sha256:9a6d3474bb86331152a798cf6d6d28c3ccee2a09c31ccbe30dbb061bf38ce60b" + "sha256:7bf515ea8cb244255a25100cd29db611a73f8d3d0aaf672ed3266307e14cc1ca", + "sha256:984cebba69e889401bfe3adb9088ca376b3a1f923f0590d005126c1bffd1a695" ], - "version": "==2.1.0" + "index": "pypi", + "version": "==3.0.4" }, "whitenoise": { "hashes": [ - "sha256:15f43b2e701821b95c9016cf469d29e2a546cb1c7dead584ba82c36f843995cf", - "sha256:9d81515f2b5b27051910996e1e860b1332e354d9e7bcf30c98f21dcb6713e0dd" + "sha256:05ce0be39ad85740a78750c86a93485c40f08ad8c62a6006de0233765996e5c7", + "sha256:05d00198c777028d72d8b0bbd234db605ef6d60e9410125124002518a48e515d" ], - "version": "==3.3.1" + "index": "pypi", + "version": "==5.2.0" } }, "develop": {} diff --git a/README.md b/README.md index 4a6e042..7c4b27b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is an example application showcasing how to build test and deploy a Django You can follow along with this project by reading the [documentation](https://circleci.com/docs/2.0/language-python/). -## Features of the demos +## Features of the demo - regularly updated to use latest Python and Django (currently Python 3.6.4 and Django 2.0.1) - uses [pipenv](http://pipenv.readthedocs.io/en/latest/) to install and manage dependencies and virtualenvs on CircleCI diff --git a/catalog/admin.py b/catalog/admin.py index ba5e294..4509725 100644 --- a/catalog/admin.py +++ b/catalog/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin # Register your models here. -from .models import Genre, Book, BookInstance, Language +from .models import Author, Genre, Book, BookInstance, Language """ # Minimal registration of Models. diff --git a/catalog/migrations/0023_auto_20200902_1539.py b/catalog/migrations/0023_auto_20200902_1539.py deleted file mode 100644 index 499a58a..0000000 --- a/catalog/migrations/0023_auto_20200902_1539.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.1.1 on 2020-09-02 15:39 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('catalog', '0022_merge_20180115_2033'), - ] - - operations = [ - migrations.AlterModelOptions( - name='author', - options={'ordering': ['last_name', 'first_name']}, - ), - ] diff --git a/catalog/models.py b/catalog/models.py index 6e51a25..0bd2908 100644 --- a/catalog/models.py +++ b/catalog/models.py @@ -70,7 +70,7 @@ class Book(models.Model): import uuid # Required for unique book instances from datetime import date -# from django.contrib.auth.models import User #Required to assign User as a borrower +from django.contrib.auth.models import User #Required to assign User as a borrower class BookInstance(models.Model): """ diff --git a/catalog/tests/test_models.py b/catalog/tests/test_models.py index 3e5fed9..9f2d41e 100644 --- a/catalog/tests/test_models.py +++ b/catalog/tests/test_models.py @@ -2,8 +2,7 @@ from django.test import TestCase # Create your tests here. -import django.db -from ..models import Author +from catalog.models import Author class AuthorModelTest(TestCase): diff --git a/catalog/tests/test_views.py b/catalog/tests/test_views.py index 7a5e40e..77715ca 100644 --- a/catalog/tests/test_views.py +++ b/catalog/tests/test_views.py @@ -1,8 +1,9 @@ from django.test import TestCase # Create your tests here. -import django.db -from ..models import Author + + +from catalog.models import Author from django.urls import reverse class AuthorListViewTest(TestCase): @@ -309,11 +310,11 @@ class AuthorCreateViewTest(TestCase): resp = self.client.get(reverse('author_create') ) self.assertRedirects(resp, '/accounts/login/?next=/catalog/author/create/' ) - def test_redirect_if_logged_in_but_not_correct_permission(self): + def test_forbidden_if_logged_in_but_not_correct_permission(self): login = self.client.login(username='testuser1', password='12345') - resp = self.client.get(reverse('author_create') ) - self.assertRedirects(resp, '/accounts/login/?next=/catalog/author/create/' ) - + resp = self.client.get(reverse('author_create')) + self.assertEqual(resp.status_code, 403) + def test_logged_in_with_permission(self): login = self.client.login(username='testuser2', password='12345') resp = self.client.get(reverse('author_create') ) diff --git a/locallibrary/settings.py b/locallibrary/settings.py index 5656c0d..60668e3 100644 --- a/locallibrary/settings.py +++ b/locallibrary/settings.py @@ -134,9 +134,7 @@ import dj_database_url db_from_env = dj_database_url.config(conn_max_age=500) DATABASES['default'].update(db_from_env) -# import Django and setup applications -import django -django.setup() + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.10/howto/static-files/ diff --git a/requirements.txt b/requirements.txt index 7fa90c4..d4b992b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,18 +1,10 @@ -asgiref==3.2.10 -attrs==20.1.0 +-i https://pypi.python.org/simple +asgiref==3.2.10; python_version >= '3.5' dj-database-url==0.5.0 -Django==3.1.1 -iniconfig==1.0.1 -more-itertools==8.5.0 -packaging==20.4 -pluggy==0.13.1 -py==1.9.0 -pybuilder==0.12.8 -pyparsing==2.4.7 -pytest==6.0.1 +django==3.1.1 +gunicorn==20.0.4 +psycopg2-binary==2.8.6 pytz==2020.1 -six==1.15.0 -sqlparse==0.3.1 -toml==0.10.1 +sqlparse==0.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' unittest-xml-reporting==3.0.4 -xmlrunner==1.7.7 +whitenoise==5.2.0 diff --git a/test-results/TEST-catalog.tests.test_forms.RenewBookFormTest-20200901215420.xml b/test-results/TEST-catalog.tests.test_forms.RenewBookFormTest-20200901215420.xml deleted file mode 100644 index 16e6328..0000000 --- a/test-results/TEST-catalog.tests.test_forms.RenewBookFormTest-20200901215420.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/test-results/TEST-catalog.tests.test_models.AuthorModelTest-20200901215420.xml b/test-results/TEST-catalog.tests.test_models.AuthorModelTest-20200901215420.xml deleted file mode 100644 index 10acce8..0000000 --- a/test-results/TEST-catalog.tests.test_models.AuthorModelTest-20200901215420.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/test-results/TEST-catalog.tests.test_views.AuthorCreateViewTest-20200901215420.xml b/test-results/TEST-catalog.tests.test_views.AuthorCreateViewTest-20200901215420.xml deleted file mode 100644 index a2306d7..0000000 --- a/test-results/TEST-catalog.tests.test_views.AuthorCreateViewTest-20200901215420.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/test-results/TEST-catalog.tests.test_views.AuthorListViewTest-20200901215420.xml b/test-results/TEST-catalog.tests.test_views.AuthorListViewTest-20200901215420.xml deleted file mode 100644 index 0aecc2e..0000000 --- a/test-results/TEST-catalog.tests.test_views.AuthorListViewTest-20200901215420.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/test-results/TEST-catalog.tests.test_views.LoanedBookInstancesByUserListViewTest-20200901215420.xml b/test-results/TEST-catalog.tests.test_views.LoanedBookInstancesByUserListViewTest-20200901215420.xml deleted file mode 100644 index 75b778d..0000000 --- a/test-results/TEST-catalog.tests.test_views.LoanedBookInstancesByUserListViewTest-20200901215420.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/test-results/TEST-catalog.tests.test_views.RenewBookInstancesViewTest-20200901215420.xml b/test-results/TEST-catalog.tests.test_views.RenewBookInstancesViewTest-20200901215420.xml deleted file mode 100644 index 624c219..0000000 --- a/test-results/TEST-catalog.tests.test_views.RenewBookInstancesViewTest-20200901215420.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - From 84e572f10f4f4f01ba2cabbc81cc0579cd389b69 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 21:05:03 +0200 Subject: [PATCH 12/27] pip to upgrade for psql bin --- .gitignore | 4 ---- Jenkinsfile | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0d2271e..065c32b 100644 --- a/.gitignore +++ b/.gitignore @@ -35,10 +35,6 @@ var/ .installed.cfg *.egg -# Test reports -test-reports/ -test-results/ - # PyInstaller # Usually these files are written by a python script from a template diff --git a/Jenkinsfile b/Jenkinsfile index c731690..14696dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,6 +36,7 @@ pipeline { python -m venv ${PY_ENV} source ${PY_ENV}/bin/activate export PATH=${PY_ENV}/bin:${PATH} + pip install -U pip pip install -r requirements.txt python3 manage.py migrate python manage.py test From 1e985395d8248fcc9886e3aaf1eb2ab024882202 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 21:19:22 +0200 Subject: [PATCH 13/27] bump the psycop version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d4b992b..004811b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ asgiref==3.2.10; python_version >= '3.5' dj-database-url==0.5.0 django==3.1.1 gunicorn==20.0.4 -psycopg2-binary==2.8.6 +psycopg2-binary==2.9.1 pytz==2020.1 sqlparse==0.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' unittest-xml-reporting==3.0.4 From c5fb431c33c321b5dbc71ba9b836127ea9b6b717 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 21:51:42 +0200 Subject: [PATCH 14/27] checking in drone --- .drone.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..77614df --- /dev/null +++ b/.drone.yml @@ -0,0 +1,23 @@ +local Pipeline(name, image) = { + kind: "pipeline", + name: name, + steps: [ + { + name: "test", + image: image, + commands: [ + "apt-get install libpg", + "pip install -r requirements.txt", + "python manage.py migrate", + "python manage.py test" + ] + } + ] +}; + +[ + Pipeline("python-2", "python:2"), + Pipeline("python-3-6", "python:3.6"), + Pipeline("python-3-8", "python:3.8"), + Pipeline("python-3-9", "python:3.9"), +] From f81d0f93a43b9761b7a1875ddb7f38b7bd90aef5 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 22:09:25 +0200 Subject: [PATCH 15/27] drone install libpg --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 77614df..5b6ed6a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,7 +6,7 @@ local Pipeline(name, image) = { name: "test", image: image, commands: [ - "apt-get install libpg", + "apt-get install -yqq --no-install-recommends libpg", "pip install -r requirements.txt", "python manage.py migrate", "python manage.py test" From 647c093585ed4ff07ec8a28599d026d2027d9933 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 22:18:16 +0200 Subject: [PATCH 16/27] renamed drone --- .drone.yml => .drone.jsonnet | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .drone.yml => .drone.jsonnet (100%) diff --git a/.drone.yml b/.drone.jsonnet similarity index 100% rename from .drone.yml rename to .drone.jsonnet From ce344cfd7cac94a0f96b0ec95eb8bcb493daa3fa Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Tue, 1 Mar 2022 22:23:16 +0200 Subject: [PATCH 17/27] re-run --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c4b27b..b801d08 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CircleCI](https://circleci.com/gh/CircleCI-Public/circleci-demo-python-django.svg?style=svg)](https://circleci.com/gh/CircleCI-Public/circleci-demo-python-django) -This is an example application showcasing how to build test and deploy a Django app on CircleCI 2.0. +This is an example application showcasing how to build test and deploy a Django app on CircleCI 2.0 You can follow along with this project by reading the [documentation](https://circleci.com/docs/2.0/language-python/). From 841cd7948a431b0d5fe3c826cd121484b48ef5b2 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Thu, 3 Mar 2022 15:16:35 +0200 Subject: [PATCH 18/27] Post update test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b801d08..7c4b27b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CircleCI](https://circleci.com/gh/CircleCI-Public/circleci-demo-python-django.svg?style=svg)](https://circleci.com/gh/CircleCI-Public/circleci-demo-python-django) -This is an example application showcasing how to build test and deploy a Django app on CircleCI 2.0 +This is an example application showcasing how to build test and deploy a Django app on CircleCI 2.0. You can follow along with this project by reading the [documentation](https://circleci.com/docs/2.0/language-python/). From 101100b3cccf2bf61aa39ce7138f391391ea64d5 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Thu, 3 Mar 2022 23:35:17 +0200 Subject: [PATCH 19/27] convert to using py37 --- .drone.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 5b6ed6a..6a0f841 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -17,7 +17,7 @@ local Pipeline(name, image) = { [ Pipeline("python-2", "python:2"), - Pipeline("python-3-6", "python:3.6"), + Pipeline("python-3-7", "python:3.7"), Pipeline("python-3-8", "python:3.8"), Pipeline("python-3-9", "python:3.9"), ] From da79f985fa763edf1a4a3b867cad325fd60ed707 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 02:08:51 +0200 Subject: [PATCH 20/27] force arm64 --- .drone.jsonnet | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.jsonnet b/.drone.jsonnet index 6a0f841..d01c9b2 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,6 +1,7 @@ local Pipeline(name, image) = { kind: "pipeline", name: name, + platform: "arch: arm64", steps: [ { name: "test", From bb9ac8080da9135a948d6981702fa12653dc480e Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 02:16:37 +0200 Subject: [PATCH 21/27] jsonet arch fix --- .drone.jsonnet | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index d01c9b2..b610c9e 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,7 +1,9 @@ local Pipeline(name, image) = { kind: "pipeline", name: name, - platform: "arch: arm64", + platform: { + "arch": "arm64" + } steps: [ { name: "test", From 6cce92946a2d69f3df6e32b500dddbc70707dd1b Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 02:19:16 +0200 Subject: [PATCH 22/27] arm64 comman missing --- .drone.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index b610c9e..8db1324 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -3,7 +3,7 @@ local Pipeline(name, image) = { name: name, platform: { "arch": "arm64" - } + }, steps: [ { name: "test", From 9aed1fcbe4d7d7813c6947a08b49e6fa141c2181 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 16:11:01 +0200 Subject: [PATCH 23/27] Using libpq-dev --- .drone.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 8db1324..a18517f 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -9,7 +9,7 @@ local Pipeline(name, image) = { name: "test", image: image, commands: [ - "apt-get install -yqq --no-install-recommends libpg", + "apt-get install -yqq --no-install-recommends libpq-dev", "pip install -r requirements.txt", "python manage.py migrate", "python manage.py test" From 64eca107b59236aa36f72032ff4ea536c1f6264e Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 16:54:04 +0200 Subject: [PATCH 24/27] Jenkins is using alpine images --- .drone.jsonnet | 2 +- Jenkinsfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index a18517f..db23596 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -19,7 +19,7 @@ local Pipeline(name, image) = { }; [ - Pipeline("python-2", "python:2"), + Pipeline("python-3-5", "python:3.5"), Pipeline("python-3-7", "python:3.7"), Pipeline("python-3-8", "python:3.8"), Pipeline("python-3-9", "python:3.9"), diff --git a/Jenkinsfile b/Jenkinsfile index 14696dd..317d886 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,13 +26,14 @@ pipeline { stage('test') { agent { docker { image "python:$PY_VERSION" - args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'} + args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings" -u 0:0'} } environment { PY_ENV = "/tmp/pitestenv" } steps { sh ''' + apk install --no-cache libpq-dev python -m venv ${PY_ENV} source ${PY_ENV}/bin/activate export PATH=${PY_ENV}/bin:${PATH} From a78b5761b5d88ba3a0126fb3fe59d9bd643b2668 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 17:03:24 +0200 Subject: [PATCH 25/27] Allow apk to install --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 317d886..c34513e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ pipeline { } steps { sh ''' - apk install --no-cache libpq-dev + apk add --no-cache libpq-dev python -m venv ${PY_ENV} source ${PY_ENV}/bin/activate export PATH=${PY_ENV}/bin:${PATH} From c5c9a67924c90cf35fadef8e7066495e9c91e76b Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 17:13:29 +0200 Subject: [PATCH 26/27] Fixed issues with gcc for apk and updated to python version 3.6 --- .drone.jsonnet | 2 +- Jenkinsfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index db23596..02734f3 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -19,7 +19,7 @@ local Pipeline(name, image) = { }; [ - Pipeline("python-3-5", "python:3.5"), + Pipeline("python-3-6", "python:3.6"), Pipeline("python-3-7", "python:3.7"), Pipeline("python-3-8", "python:3.8"), Pipeline("python-3-9", "python:3.9"), diff --git a/Jenkinsfile b/Jenkinsfile index c34513e..2b35421 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ pipeline { } steps { sh ''' - apk add --no-cache libpq-dev + apk --no-cache add --virtual build-dependencies libpq-dev gcc musl-dev python -m venv ${PY_ENV} source ${PY_ENV}/bin/activate export PATH=${PY_ENV}/bin:${PATH} From 35659c548062e711c9e20ff2e2c3eef47f46f637 Mon Sep 17 00:00:00 2001 From: Mpho raf Date: Sun, 20 Mar 2022 18:53:47 +0200 Subject: [PATCH 27/27] Updated to use py module for xmlrunner --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b35421..2bd022d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { pip install -r requirements.txt python3 manage.py migrate python manage.py test - xmlrunner discover -p *_test.py + python -m xmlrunner discover -p *_test.py ''' } }