diff --git a/docs/src/api/builtins/test.md b/docs/src/api/builtins/test.md index a62c0cc1..30092084 100644 --- a/docs/src/api/builtins/test.md +++ b/docs/src/api/builtins/test.md @@ -164,10 +164,7 @@ Example: ```nix { testPython = { - example = { - python = "3.9"; - src = "/test/test-python"; - }; + example.src = "/test/test-python"; }; } ``` diff --git a/makes.nix b/makes.nix index cf908a73..42a67d9b 100644 --- a/makes.nix +++ b/makes.nix @@ -252,11 +252,9 @@ }; testPython = { example = { - python = "3.12"; src = "/test/test-python"; }; cliMain = { - python = "3.10"; extraFlags = [ "--cov=main" "--cov-branch" diff --git a/src/args/test-python/default.nix b/src/args/test-python/default.nix index 3d5c3f9f..d7eb9a25 100644 --- a/src/args/test-python/default.nix +++ b/src/args/test-python/default.nix @@ -1,5 +1,5 @@ { - makePythonPypiEnvironment, + makePythonEnvironment, makeSearchPaths, makeScript, toBashArray, @@ -10,32 +10,25 @@ extraSrcs, name, project, - python, searchPaths, src, -}: let - pythonPypiEnvironment = makePythonPypiEnvironment { - inherit name; - sourcesYaml = - { - "3.9" = ./pypi-sources-3.9.yaml; - "3.10" = ./pypi-sources-3.10.yaml; - "3.11" = ./pypi-sources-3.11.yaml; - "3.12" = ./pypi-sources-3.12.yaml; - } - .${python}; +}: +makeScript { + name = "test-python-for-${name}"; + replace = { + __argExtraFlags__ = toBashArray extraFlags; + __argExtraSrcs__ = toBashMap extraSrcs; + __argProject__ = project; + __argSrc__ = src; }; -in - makeScript { - name = "test-python-for-${name}"; - replace = { - __argExtraFlags__ = toBashArray extraFlags; - __argExtraSrcs__ = toBashMap extraSrcs; - __argProject__ = project; - __argSrc__ = src; - }; - entrypoint = ./entrypoint.sh; - searchPaths = { - source = [pythonPypiEnvironment (makeSearchPaths searchPaths)]; - }; - } + entrypoint = ./entrypoint.sh; + searchPaths = { + source = [ + (makePythonEnvironment { + pythonProjectDir = ./.; + pythonVersion = "3.11"; + }) + (makeSearchPaths searchPaths) + ]; + }; +} diff --git a/src/args/test-python/poetry.lock b/src/args/test-python/poetry.lock new file mode 100644 index 00000000..431026ea --- /dev/null +++ b/src/args/test-python/poetry.lock @@ -0,0 +1,94 @@ +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. + +[[package]] +name = "attrs" +version = "23.2.0" +description = "Classes Without Boilerplate" +optional = false +python-versions = ">=3.7" +files = [ + {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, + {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, +] + +[package.extras] +cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] +dev = ["attrs[tests]", "pre-commit"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] +tests = ["attrs[tests-no-zope]", "zope-interface"] +tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"] +tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"] + +[[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 = "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 = "23.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, + {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, +] + +[[package]] +name = "pluggy" +version = "1.3.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, + {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "7.2.0" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.2.0-py3-none-any.whl", hash = "sha256:892f933d339f068883b6fd5a459f03d85bfcb355e4981e146d2c7616c21fef71"}, + {file = "pytest-7.2.0.tar.gz", hash = "sha256:c4014eb40e10f11f355ad4e3c2fb2c6c6d1919c73f3b5a433de4708202cade59"}, +] + +[package.dependencies] +attrs = ">=19.2.0" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" + +[package.extras] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.11" +content-hash = "31b3d40c9cc52557b657df28967512319964fdf3447804ba5f543f48ccbf3ef7" diff --git a/src/args/test-python/pyproject.toml b/src/args/test-python/pyproject.toml new file mode 100644 index 00000000..09e8e411 --- /dev/null +++ b/src/args/test-python/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "lint-python-imports" +version = "0.1.0" +description = "" +authors = ["Your Name "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.11" +pytest = "7.2.0" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/src/evaluator/modules/test-python/default.nix b/src/evaluator/modules/test-python/default.nix index 9cd291e9..d1d1fa55 100644 --- a/src/evaluator/modules/test-python/default.nix +++ b/src/evaluator/modules/test-python/default.nix @@ -15,7 +15,6 @@ inherit (args) extraSrcs; inherit (args) extraFlags; project = projectPath "/"; - inherit (args) python; inherit (args) searchPaths; inherit (args) src; }; @@ -34,9 +33,6 @@ in { default = []; type = lib.types.listOf lib.types.str; }; - python = lib.mkOption { - type = lib.types.enum ["3.9" "3.10" "3.11" "3.12"]; - }; searchPaths = lib.mkOption { default = {}; type = lib.types.attrs;