From 6e9f96834dd44e9dfb78001d159149efaaa31c6d Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 3 May 2024 08:07:05 -0400 Subject: [PATCH] chore: add git subdirectory test --- tests/default.nix | 1 + tests/git-subdirectory-hook/default.nix | 19 +++ tests/git-subdirectory-hook/poetry.lock | 169 +++++++++++++++++++++ tests/git-subdirectory-hook/pyproject.toml | 16 ++ 4 files changed, 205 insertions(+) create mode 100644 tests/git-subdirectory-hook/default.nix create mode 100644 tests/git-subdirectory-hook/poetry.lock create mode 100644 tests/git-subdirectory-hook/pyproject.toml diff --git a/tests/default.nix b/tests/default.nix index 46acad5..ede0522 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -161,6 +161,7 @@ in apsw = callTest ./apsw { }; no-infinite-recur-on-missing-gitignores = callTest ./no-infinite-recur-on-missing-gitignores { }; pyzmq = callTest ./pyzmq { }; + git-subdirectory-hook = callTest ./git-subdirectory-hook { }; } // lib.optionalAttrs (!stdenv.isDarwin) { # pyqt5 = (callTest ./pyqt5 { }); pyqt6 = callTest ./pyqt6 { }; diff --git a/tests/git-subdirectory-hook/default.nix b/tests/git-subdirectory-hook/default.nix new file mode 100644 index 0000000..a750407 --- /dev/null +++ b/tests/git-subdirectory-hook/default.nix @@ -0,0 +1,19 @@ +{ poetry2nix, python3, runCommand }: +let + env = poetry2nix.mkPoetryEnv { + python = python3; + projectDir = ./.; + overrides = [ + (final: prev: { + trivial = prev.trivial.overridePythonAttrs (attrs: { + nativeBuildInputs = attrs.nativeBuildInputs or [ ] ++ [ final.poetry-core ]; + }); + }) + poetry2nix.defaultPoetryOverrides + ]; + }; +in +runCommand "git-subdirectory" { } '' + ${env}/bin/python -c 'import trivial' + touch $out +'' diff --git a/tests/git-subdirectory-hook/poetry.lock b/tests/git-subdirectory-hook/poetry.lock new file mode 100644 index 0000000..7f553da --- /dev/null +++ b/tests/git-subdirectory-hook/poetry.lock @@ -0,0 +1,169 @@ +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.2.1" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"}, + {file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "importlib-metadata" +version = "7.1.0" +description = "Read metadata from Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "importlib_metadata-7.1.0-py3-none-any.whl", hash = "sha256:30962b96c0c223483ed6cc7280e7f0199feb01a0e40cfae4d4450fc6fab1f570"}, + {file = "importlib_metadata-7.1.0.tar.gz", hash = "sha256:b78938b926ee8d5f020fc4772d487045805a55ddbad2ecf21c6d60938dc7fcd2"}, +] + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +perf = ["ipython"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-perf (>=0.9.2)", "pytest-ruff (>=0.2.1)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "packaging" +version = "24.0" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, + {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "8.2.0" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.2.0-py3-none-any.whl", hash = "sha256:1733f0620f6cda4095bbf0d9ff8022486e91892245bb9e7d5542c018f612f233"}, + {file = "pytest-8.2.0.tar.gz", hash = "sha256:d507d4482197eac0ba2bae2e9babf0672eb333017bcedaa5fb1a3d42c1174b3f"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.5,<2.0" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} + +[package.extras] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-randomly" +version = "3.15.0" +description = "Pytest plugin to randomly order tests and control random.seed." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_randomly-3.15.0-py3-none-any.whl", hash = "sha256:0516f4344b29f4e9cdae8bce31c4aeebf59d0b9ef05927c33354ff3859eeeca6"}, + {file = "pytest_randomly-3.15.0.tar.gz", hash = "sha256:b908529648667ba5e54723088edd6f82252f540cc340d748d1fa985539687047"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=3.6.0", markers = "python_version < \"3.10\""} +pytest = "*" + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "trivial" +version = "0.1.0" +description = "poetry2nix pytest-randomly test" +optional = false +python-versions = "^3.8" +files = [] +develop = false + +[package.dependencies] +pytest-randomly = "^3.10.1" + +[package.source] +type = "git" +url = "https://github.com/nix-community/poetry2nix" +reference = "HEAD" +resolved_reference = "c5cd236c1203ce1bd526837958b0129ff666c6c6" +subdirectory = "tests/pytest-randomly" + +[[package]] +name = "zipp" +version = "3.18.1" +description = "Backport of pathlib-compatible object wrapper for zip files" +optional = false +python-versions = ">=3.8" +files = [ + {file = "zipp-3.18.1-py3-none-any.whl", hash = "sha256:206f5a15f2af3dbaee80769fb7dc6f249695e940acca08dfb2a4769fe61e538b"}, + {file = "zipp-3.18.1.tar.gz", hash = "sha256:2884ed22e7d8961de1c9a05142eb69a247f120291bc0206a00a7642f09b5b715"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.9" +content-hash = "ccf8d7009119768e8a662e1e37c45bf6f586f106843ba18c24f5d62073bea8d3" diff --git a/tests/git-subdirectory-hook/pyproject.toml b/tests/git-subdirectory-hook/pyproject.toml new file mode 100644 index 0000000..8d7659d --- /dev/null +++ b/tests/git-subdirectory-hook/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "test-subdirectory" +version = "0.1.0" +description = "Test of subdirectory" +authors = ["Your Name "] + +[tool.poetry.dependencies] +python = "^3.9" + +[tool.poetry.dependencies.trivial] +git = "https://github.com/nix-community/poetry2nix" +subdirectory = "tests/pytest-randomly" + +[build-system] +requires = ["poetry-core>=1"] +build-backend = "poetry.core.masonry.api"