Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run the test suite as part of the nix build #477

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- run: nix build
- run: nix build -L
- run: nix flake check
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ include src/batou/insecure-private.key
recursive-include src/batou/init-template *
recursive-include src/batou/tests/fixture *
recursive-include src/batou/lib/resources *
recursive-include src/batou/lib/tests *
recursive-include src/batou/secrets/tests/fixture *
global-include *.txt
global-include *.in
23 changes: 22 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,28 @@

devShells.default = pkgs.mkShell {
packages = [
(pkgs.python3.withPackages (ps: [batou ps.tox]))
#(pkgs.python3.withPackages (ps: [ps.tox ps.setuptools ps.pytest]))
(pkgs.python3.withPackages (ps: [
ps.mock
ps.pytest
ps.pytest-cov
ps.pytest-instafail
ps.pytest-timeout

ps.requests
ps.pyyaml
ps.execnet
ps.importlib-metadata
ps.importlib-resources
ps.remote-pdb
ps.py
ps.configupdater
ps.setuptools
ps.jinja2
]))
pkgs.mercurial
pkgs.age
pkgs.subversion
];

shellHook = ''
Expand Down
108 changes: 84 additions & 24 deletions nix/batou.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
gnupg,
rsync,
unzip,
git,
subversion,
age,
mercurial,
buildPythonPackage,
fetchPypi,
markupsafe,
requests,
pyyaml,
execnet,
Expand All @@ -10,29 +15,84 @@
remote-pdb,
py,
configupdater,
mock,
pytest,
setuptools,
jinja2,
src,
pytestCheckHook,
mock,
pytest-cov,
pytest-instafail,
pytest-timeout,
python,
}:
buildPythonPackage {
propagatedBuildInputs = [
requests
pyyaml
execnet
importlib-metadata
importlib-resources
remote-pdb
py
configupdater
mock
pytest
setuptools
jinja2
];

pname = "batou";
version = "latest";
inherit src;
}
buildPythonPackage {
build-system = [setuptools];
dependencies = [
configupdater
execnet
importlib-metadata
importlib-resources
jinja2
py
pyyaml
remote-pdb
requests
];

nativeCheckInputs = [
pytestCheckHook

mock
py
pytest-cov
pytest-instafail
pytest-timeout
requests

age
git
gnupg
mercurial
rsync
subversion
unzip
];

PY_IGNORE_IMPORTMISMATCH = 1;

preCheck = ''
export PYTHONPATH=${py}/${python.sitePackages}:$PYTHONPATH
'';

disabledTests = [
# requires internet access
"test_manage__2_age"
"test_manage__reencrypt__1"

# requires access to /usr/bin/hdiutil
"test_dmg_extracts_archive_to_target_directory"

# cannot resolve hosts in sandbox
"test_address_netloc_attributes"
"test_address_resolves_listen_address"

# does not return relative but absolute paths
# can probably be fixed, then reenabled
"test_edit_command_loop"
];

disabledTestPaths = [
# requires internet access for download / pip install
"src/batou/lib/tests/test_appenv.py"
"src/batou/lib/tests/test_buildout.py"
"src/batou/lib/tests/test_download.py"
"src/batou/lib/tests/test_supervisor.py"

# bad interpreter `/usr/bin/env python3` in appenv.py
"src/batou/tests/test_endtoend.py"
];

pname = "batou";
version = "latest";
inherit src;
}
2 changes: 2 additions & 0 deletions src/batou/secrets/tests/fixture/gnupg/S.gpg-agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%Assuan%
socket=/tmp/S.gpg-agent-batou
2 changes: 2 additions & 0 deletions src/batou/secrets/tests/fixture/gnupg/S.gpg-agent.ssh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%Assuan%
socket=/tmp/S.gpg-agent-batou.ssh
2 changes: 2 additions & 0 deletions src/batou/secrets/tests/fixture/gnupg/gpg-agent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extra-socket /tmp/S.gpg-agent-batou.extra
browser-socket /tmp/S.gpg-agent-batou.browser
Loading