Skip to content

Commit

Permalink
refac(back): fluidattacks#1378 deprecate test python
Browse files Browse the repository at this point in the history
- Deprecate testPython
as it is too specific to the python language
and lacks too much flexibility.
- Remove unused tests
- Remove unused autocomplete
- Remove jobs from pipeline
- Remove documentation

Signed-off-by: Daniel Salazar <[email protected]>
  • Loading branch information
dsalaza4 committed Dec 12, 2024
1 parent 6597334 commit 0bd499e
Show file tree
Hide file tree
Showing 16 changed files with 1 addition and 463 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -465,38 +465,6 @@ jobs:
- name: /testLicense
run: nix-env -if . && m . /testLicense

linux_testPython_cliMain:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /testPython/cliMain
with:
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /testPython/cliMain"
macos_testPython_cliMain:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
- name: /testPython/cliMain
run: nix-env -if . && m . /testPython/cliMain

linux_testPython_example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /testPython/example
with:
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /testPython/example"
macos_testPython_example:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
- name: /testPython/example
run: nix-env -if . && m . /testPython/example

linux_tests_calculateCvss3:
runs-on: ubuntu-latest
steps:
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -649,26 +649,6 @@ jobs:
- name: /testLicense
run: nix-env -if . && m . /testLicense

linux_testPython_example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /testPython/example
with:
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /testPython/example"
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
macos_testPython_example:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
- name: /testPython/example
run: nix-env -if . && m . /testPython/example
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

linux_tests_calculateCvss3:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .mailmap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Andres Cuberos <[email protected]> Andres Cuberos <[email protected]>
Andres Cuberos <[email protected]> Andres Cuberos <[email protected]>
Andres Uribe <[email protected]> Andres Uribe <[email protected]>
Andres Saldarriaga <[email protected]> Andres Saldarriaga <[email protected]>
Andres Uribe <[email protected]> Andres Uribe <[email protected]>
Brandon Lotero <[email protected]> Brandon Lotero <[email protected]>
Briam Agudelo <[email protected]> Briam Agudelo <[email protected]>
Daniel Murcia <[email protected]> Daniel F. Murcia Rivera <[email protected]>
Expand Down
78 changes: 0 additions & 78 deletions docs/src/api/builtins/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,84 +26,6 @@ Example:
m . /testLicense
```

## testPython

Test Python code
with [pytest](https://docs.pytest.org/).

Types:

- testPython (`attrsOf targetType`): Optional.
Mapping of names to pytest targets.
Defaults to `{ }`.
- targetType (`submodule`):
- python (`enum ["3.9" "3.10" "3.11" "3.12"]`):
Python interpreter version that your package/module is designed for.
- src (`str`):
Path to the file or directory that contains the tests code.
- searchPaths (`asIn makeSearchPaths`): Optional.
Arguments here will be passed as-is to `makeSearchPaths`.
Defaults to `makeSearchPaths`'s defaults.
- extraFlags (`listOf str`): Optional.
Extra command line arguments to propagate to pytest.
Defaults to `[ ]`.
- extraSrcs (`attrsOf package`): Optional.
Place extra sources at the same level of your project code
so you can reference them via relative paths.

The final test structure looks like this:

```bash
/tmp/some-random-unique-dir
├── __project__ # The entire source code of your project
│  ├── ...
│  └── path/to/src
... # repeat for all extraSrcs
├── "${extraSrcName}"
│  └── "${extraSrcValue}"
...
```

And we will run pytest like this:

```bash
pytest /tmp/some-random-unique-dir/__project__/path/to/src
```

Defaults to `{ }`.

Example:

=== "makes.nix"

```nix
{
testPython = {
example.src = "/test/test-python";
};
}
```

=== "Invocation"

```bash
m . /testPython/example
```

=== "Directory"

```bash
$ tree test/test-python/
test/test-python/
└── test_something.py
$ cat test/test-python/test_something.py
1 def test_one_plus_one_equals_two() -> None:
2 assert (1 + 1) == 2
```

## testTerraform

Test Terraform code
Expand Down
17 changes: 0 additions & 17 deletions makes.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,6 @@
};
};
testLicense = { enable = true; };
testPython = {
example = { src = "/test/test-python"; };
cliMain = {
extraFlags = [
"--cov=main"
"--cov-branch"
"--cov-report=term-missing"
"--capture=no"
];
searchPaths = {
bin = [ __nixpkgs__.git ];
pythonPackage = [ (projectPath "/src/cli/main") ];
source = [ outputs."/cli/env/test" outputs."/cli/env/runtime" ];
};
src = "/src/cli";
};
};
testTerraform = {
modules = {
module = {
Expand Down
13 changes: 0 additions & 13 deletions makes/utils/makePythonLock/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ function main {
&& "${cmd[@]}" 3.12 \
"${PWD}/src/args/make-python-pypi-environment/sources/numpy-1.24.0/dependencies.yaml" \
"${PWD}/src/args/make-python-pypi-environment/sources/numpy-1.24.0/sources-312.yaml"

: && "${cmd[@]}" 3.9 \
"${PWD}/src/args/test-python/pypi-deps.yaml" \
"${PWD}/src/args/test-python/pypi-sources-3.9.yaml" \
&& "${cmd[@]}" 3.10 \
"${PWD}/src/args/test-python/pypi-deps.yaml" \
"${PWD}/src/args/test-python/pypi-sources-3.10.yaml" \
&& "${cmd[@]}" 3.11 \
"${PWD}/src/args/test-python/pypi-deps.yaml" \
"${PWD}/src/args/test-python/pypi-sources-3.11.yaml" \
&& "${cmd[@]}" 3.12 \
"${PWD}/src/args/test-python/pypi-deps.yaml" \
"${PWD}/src/args/test-python/pypi-sources-3.12.yaml"
}

main "${@}"
1 change: 0 additions & 1 deletion src/args/agnostic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ let
taintTerraform = import ./taint-terraform/default.nix self;
testLicense = import ./test-license/default.nix self;
testTerraform = import ./test-terraform/default.nix self;
testPython = import ./test-python/default.nix self;
toDerivationName = __nixpkgs__.lib.strings.sanitizeDerivationName;
toBashArray = import ./to-bash-array/default.nix self;
toBashMap = import ./to-bash-map/default.nix self;
Expand Down
22 changes: 0 additions & 22 deletions src/args/test-python/default.nix

This file was deleted.

24 changes: 0 additions & 24 deletions src/args/test-python/entrypoint.sh

This file was deleted.

94 changes: 0 additions & 94 deletions src/args/test-python/poetry.lock

This file was deleted.

15 changes: 0 additions & 15 deletions src/args/test-python/pyproject.toml

This file was deleted.

Loading

0 comments on commit 0bd499e

Please sign in to comment.