From efca729a663d2998c59cff68fc1ee232dba78492 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 05:57:29 +0000 Subject: Bump markdown from 3.4.1 to 3.4.2 Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.4.1 to 3.4.2. - [Release notes](https://github.com/Python-Markdown/markdown/releases) - [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/change_log/release-2.6.md) - [Commits](https://github.com/Python-Markdown/markdown/compare/3.4.1...3.4.2) --- updated-dependencies: - dependency-name: markdown dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index 404ef9bd..1387ebf0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -842,14 +842,14 @@ files = [ [[package]] name = "markdown" -version = "3.4.1" -description = "Python implementation of Markdown." +version = "3.4.2" +description = "Python implementation of John Gruber's Markdown." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "Markdown-3.4.1-py3-none-any.whl", hash = "sha256:08fb8465cffd03d10b9dd34a5c3fea908e20391a2a90b88d66362cb05beed186"}, - {file = "Markdown-3.4.1.tar.gz", hash = "sha256:3b809086bb6efad416156e00a0da66fe47618a5d6918dd688f53f40c8e4cfeff"}, + {file = "Markdown-3.4.2-py3-none-any.whl", hash = "sha256:590e8c8139ce62a1121b4b07fd471eced441378f19f3265540de0791851977e5"}, + {file = "Markdown-3.4.2.tar.gz", hash = "sha256:e104be388c28462b4e83bd0ddfc68eff6022305cc4b5ab14caf8d235fae132b9"}, ] [package.extras] @@ -1537,4 +1537,4 @@ brotli = ["Brotli"] [metadata] lock-version = "2.0" python-versions = "3.10.*" -content-hash = "e22311a7b6bba3f8397ba214fe7640a1080c27a63f42262527909d18de6248c1" +content-hash = "364d285b6d97d84894d8bba6c6f79b6d58433c91b451b9a793aba868376603aa" diff --git a/pyproject.toml b/pyproject.toml index a8579c3f..766ce78d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ django-simple-bulma = "2.5.0" djangorestframework = "3.14.0" gunicorn = "20.1.0" httpx = "0.23.3" -markdown = "3.4.1" +markdown = "3.4.2" psycopg2-binary = "2.9.5" PyJWT = {version = "2.6.0", extras = ["crypto"]} pymdown-extensions = "9.10" -- cgit v1.2.3 From 23b920e22f2d4c47782348f9ad9cd9c8d3aee960 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Mar 2023 05:58:13 +0000 Subject: Bump flake8-bugbear from 23.3.12 to 23.3.23 Bumps [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) from 23.3.12 to 23.3.23. - [Release notes](https://github.com/PyCQA/flake8-bugbear/releases) - [Commits](https://github.com/PyCQA/flake8-bugbear/compare/23.3.12...23.3.23) --- updated-dependencies: - dependency-name: flake8-bugbear dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index 1387ebf0..2003b11b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -596,19 +596,19 @@ flake8 = ">=5.0.0" [[package]] name = "flake8-bugbear" -version = "23.3.12" +version = "23.3.23" description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." category = "dev" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8.1" files = [ - {file = "flake8-bugbear-23.3.12.tar.gz", hash = "sha256:e3e7f74c8a49ad3794a7183353026dabd68c74030d5f46571f84c1fb0eb79363"}, - {file = "flake8_bugbear-23.3.12-py3-none-any.whl", hash = "sha256:beb5c7efcd7ccc2039ef66a77bb8db925e7be3531ff1cb4d0b7030d0e2113d72"}, + {file = "flake8-bugbear-23.3.23.tar.gz", hash = "sha256:ea565bdb87b96b56dc499edd6cc3ba7f695373d902a5f56c989b74fad7c7719d"}, + {file = "flake8_bugbear-23.3.23-py3-none-any.whl", hash = "sha256:8a218d13abd6904800970381057ce8e72cde8eea743240c4ef3ede4dd0bc9cfb"}, ] [package.dependencies] attrs = ">=19.2.0" -flake8 = ">=3.0.0" +flake8 = ">=6.0.0" [package.extras] dev = ["coverage", "hypothesis", "hypothesmith (>=0.2)", "pre-commit", "pytest", "tox"] @@ -1537,4 +1537,4 @@ brotli = ["Brotli"] [metadata] lock-version = "2.0" python-versions = "3.10.*" -content-hash = "364d285b6d97d84894d8bba6c6f79b6d58433c91b451b9a793aba868376603aa" +content-hash = "90f80fb12b0ef81d0a3099a466ad7d31d131c657d20b11dc055bee869206baa3" diff --git a/pyproject.toml b/pyproject.toml index 766ce78d..0d327225 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ taskipy = "1.10.3" flake8 = "6.0.0" flake8-annotations = "3.0.0" flake8-bandit = "4.1.1" -flake8-bugbear = "23.3.12" +flake8-bugbear = "23.3.23" flake8-docstrings = "1.7.0" flake8-import-order = "0.18.2" flake8-tidy-imports = "4.8.0" -- cgit v1.2.3 From 2088911634391bf4195eaef64aa2056b5bd66320 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Mar 2023 22:18:55 +0000 Subject: Bump markdown from 3.4.2 to 3.4.3 Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.4.2 to 3.4.3. - [Release notes](https://github.com/Python-Markdown/markdown/releases) - [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/change_log/release-2.6.md) - [Commits](https://github.com/Python-Markdown/markdown/compare/3.4.2...3.4.3) --- updated-dependencies: - dependency-name: markdown dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index 2003b11b..c5dad711 100644 --- a/poetry.lock +++ b/poetry.lock @@ -842,14 +842,14 @@ files = [ [[package]] name = "markdown" -version = "3.4.2" +version = "3.4.3" description = "Python implementation of John Gruber's Markdown." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "Markdown-3.4.2-py3-none-any.whl", hash = "sha256:590e8c8139ce62a1121b4b07fd471eced441378f19f3265540de0791851977e5"}, - {file = "Markdown-3.4.2.tar.gz", hash = "sha256:e104be388c28462b4e83bd0ddfc68eff6022305cc4b5ab14caf8d235fae132b9"}, + {file = "Markdown-3.4.3-py3-none-any.whl", hash = "sha256:065fd4df22da73a625f14890dd77eb8040edcbd68794bcd35943be14490608b2"}, + {file = "Markdown-3.4.3.tar.gz", hash = "sha256:8bf101198e004dc93e84a12a7395e31aac6a9c9942848ae1d99b9d72cf9b3520"}, ] [package.extras] @@ -1537,4 +1537,4 @@ brotli = ["Brotli"] [metadata] lock-version = "2.0" python-versions = "3.10.*" -content-hash = "90f80fb12b0ef81d0a3099a466ad7d31d131c657d20b11dc055bee869206baa3" +content-hash = "b867bca3c711bbfb2625e5be0469bf7a64757e34f55826632a213f4fc9e8aa7b" diff --git a/pyproject.toml b/pyproject.toml index 0d327225..21bc26d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ django-simple-bulma = "2.5.0" djangorestframework = "3.14.0" gunicorn = "20.1.0" httpx = "0.23.3" -markdown = "3.4.2" +markdown = "3.4.3" psycopg2-binary = "2.9.5" PyJWT = {version = "2.6.0", extras = ["crypto"]} pymdown-extensions = "9.10" -- cgit v1.2.3 From feb54974056578836de841971a953f2cd206ce80 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Wed, 22 Mar 2023 23:19:44 +0100 Subject: Drop dependency to pyfakefs Create a temporary directory to manage our resource tests instead of reyling on pyfakefs to mock it away for us. This also makes the code more portable: all we need now is a way to create a temporary directory. `pathlib` mostly abstracts away the other parts for us. Since we're well-behaved, we clean up the temporary directory at the end of the Python interpreter's life using `atexit` and `shutil.rmtree`. This PR was written and tested with Python 3.9 which required some hacks in `pyproject.toml` to make it work, it may require re-locking if CI throws up. Closes #679. --- poetry.lock | 50 ++++++++++++++++++------- pydis_site/apps/content/tests/helpers.py | 63 +++++++++++++++++--------------- pyproject.toml | 1 - 3 files changed, 70 insertions(+), 44 deletions(-) diff --git a/poetry.lock b/poetry.lock index c5dad711..7fad2146 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand. [[package]] name = "anyio" @@ -825,6 +825,26 @@ files = [ {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, ] +[[package]] +name = "importlib-metadata" +version = "6.1.0" +description = "Read metadata from Python packages" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "importlib_metadata-6.1.0-py3-none-any.whl", hash = "sha256:ff80f3b5394912eb1b108fcfd444dc78b7f1f3e16b16188054bd01cb9cb86f09"}, + {file = "importlib_metadata-6.1.0.tar.gz", hash = "sha256:43ce9281e097583d758c2c708c4376371261a02c34682491a8e98352365aad20"}, +] + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +perf = ["ipython"] +testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] + [[package]] name = "libsass" version = "0.22.0" @@ -1121,18 +1141,6 @@ snowballstemmer = ">=2.2.0" [package.extras] toml = ["tomli (>=1.2.3)"] -[[package]] -name = "pyfakefs" -version = "5.1.0" -description = "pyfakefs implements a fake file system that mocks the Python file system modules." -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pyfakefs-5.1.0-py3-none-any.whl", hash = "sha256:e6f34a8224b41f1b1ab25aa8d430121dac42e3c6e981e01eae76b3343fba47d0"}, - {file = "pyfakefs-5.1.0.tar.gz", hash = "sha256:316c6026640d14a6b4fbde71fd9674576d1b5710deda8fabde8aad51d785dbc3"}, -] - [[package]] name = "pyflakes" version = "3.0.1" @@ -1534,6 +1542,22 @@ files = [ [package.extras] brotli = ["Brotli"] +[[package]] +name = "zipp" +version = "3.15.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, + {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] + [metadata] lock-version = "2.0" python-versions = "3.10.*" diff --git a/pydis_site/apps/content/tests/helpers.py b/pydis_site/apps/content/tests/helpers.py index d897c024..1eab62be 100644 --- a/pydis_site/apps/content/tests/helpers.py +++ b/pydis_site/apps/content/tests/helpers.py @@ -1,12 +1,12 @@ +import atexit +import shutil +import tempfile from pathlib import Path -from pyfakefs import fake_filesystem_unittest +from django.test import TestCase -# Set the module constant within Patcher to use the fake filesystem -# https://jmcgeheeiv.github.io/pyfakefs/master/usage.html#modules-to-reload -with fake_filesystem_unittest.Patcher() as _: - BASE_PATH = Path("res") +BASE_PATH = Path(tempfile.mkdtemp(prefix='pydis-site-content-app-tests-')) # Valid markdown content with YAML metadata @@ -50,7 +50,7 @@ PARSED_METADATA = { PARSED_CATEGORY_INFO = {"title": "Category Name", "description": "Description"} -class MockPagesTestCase(fake_filesystem_unittest.TestCase): +class MockPagesTestCase(TestCase): """ TestCase with a fake filesystem for testing. @@ -75,29 +75,32 @@ class MockPagesTestCase(fake_filesystem_unittest.TestCase): def setUp(self): """Create the fake filesystem.""" - self.setUpPyfakefs() - - self.fs.create_file(f"{BASE_PATH}/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file(f"{BASE_PATH}/root.md", contents=MARKDOWN_WITH_METADATA) - self.fs.create_file( - f"{BASE_PATH}/root_without_metadata.md", contents=MARKDOWN_WITHOUT_METADATA - ) - self.fs.create_file(f"{BASE_PATH}/not_a_page.md/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file(f"{BASE_PATH}/category/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file( - f"{BASE_PATH}/category/with_metadata.md", contents=MARKDOWN_WITH_METADATA - ) - self.fs.create_file(f"{BASE_PATH}/category/subcategory/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file( - f"{BASE_PATH}/category/subcategory/with_metadata.md", contents=MARKDOWN_WITH_METADATA - ) - self.fs.create_file( - f"{BASE_PATH}/category/subcategory/without_metadata.md", - contents=MARKDOWN_WITHOUT_METADATA - ) + Path(f"{BASE_PATH}/_info.yml").write_text(CATEGORY_INFO) + Path(f"{BASE_PATH}/root.md").write_text(MARKDOWN_WITH_METADATA) + Path(f"{BASE_PATH}/root_without_metadata.md").write_text(MARKDOWN_WITHOUT_METADATA) + Path(f"{BASE_PATH}/not_a_page.md").mkdir(exist_ok=True) + Path(f"{BASE_PATH}/not_a_page.md/_info.yml").write_text(CATEGORY_INFO) + Path(f"{BASE_PATH}/category").mkdir(exist_ok=True) + Path(f"{BASE_PATH}/category/_info.yml").write_text(CATEGORY_INFO) + Path(f"{BASE_PATH}/category/with_metadata.md").write_text(MARKDOWN_WITH_METADATA) + Path(f"{BASE_PATH}/category/subcategory").mkdir(exist_ok=True) + Path(f"{BASE_PATH}/category/subcategory/_info.yml").write_text(CATEGORY_INFO) + Path( + f"{BASE_PATH}/category/subcategory/with_metadata.md" + ).write_text(MARKDOWN_WITH_METADATA) + Path( + f"{BASE_PATH}/category/subcategory/without_metadata.md" + ).write_text(MARKDOWN_WITHOUT_METADATA) temp = f"{BASE_PATH}/tmp" # noqa: S108 - self.fs.create_file(f"{temp}/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file(f"{temp}.md", contents=MARKDOWN_WITH_METADATA) - self.fs.create_file(f"{temp}/category/_info.yml", contents=CATEGORY_INFO) - self.fs.create_dir(f"{temp}/category/subcategory_without_info") + Path(f"{temp}").mkdir(exist_ok=True) + Path(f"{temp}/_info.yml").write_text(CATEGORY_INFO) + Path(f"{temp}.md").write_text(MARKDOWN_WITH_METADATA) + Path(f"{temp}/category").mkdir(exist_ok=True) + Path(f"{temp}/category/_info.yml").write_text(CATEGORY_INFO) + Path(f"{temp}/category/subcategory_without_info").mkdir(exist_ok=True) + + @classmethod + def setUpTestData(cls): + # May get called multiple times - ignore erorrs in that case. + atexit.register(shutil.rmtree, BASE_PATH, ignore_errors=True) diff --git a/pyproject.toml b/pyproject.toml index 21bc26d7..21857f84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,6 @@ pre-commit = "3.2.0" [tool.poetry.group.test.dependencies] coverage = "7.2.2" -pyfakefs = "5.1.0" [build-system] requires = ["poetry-core>=1.2.0"] -- cgit v1.2.3 From 22c653a7179f97e4f7c4de391f9204d71f4fb6c7 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Fri, 24 Mar 2023 22:55:32 +0100 Subject: Register cleanup job after module load --- pydis_site/apps/content/tests/helpers.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pydis_site/apps/content/tests/helpers.py b/pydis_site/apps/content/tests/helpers.py index 1eab62be..fad91050 100644 --- a/pydis_site/apps/content/tests/helpers.py +++ b/pydis_site/apps/content/tests/helpers.py @@ -7,6 +7,7 @@ from django.test import TestCase BASE_PATH = Path(tempfile.mkdtemp(prefix='pydis-site-content-app-tests-')) +atexit.register(shutil.rmtree, BASE_PATH, ignore_errors=True) # Valid markdown content with YAML metadata @@ -99,8 +100,3 @@ class MockPagesTestCase(TestCase): Path(f"{temp}/category").mkdir(exist_ok=True) Path(f"{temp}/category/_info.yml").write_text(CATEGORY_INFO) Path(f"{temp}/category/subcategory_without_info").mkdir(exist_ok=True) - - @classmethod - def setUpTestData(cls): - # May get called multiple times - ignore erorrs in that case. - atexit.register(shutil.rmtree, BASE_PATH, ignore_errors=True) -- cgit v1.2.3