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

Problem: ci test dependency install fail #140

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: python3 -m pip install --user --upgrade poetry
- name: install
run: poetry install
- name: Run tests
run: make test
run: nix develop -c python -mpytest
yihuang marked this conversation as resolved.
Show resolved Hide resolved
nix-flake:
runs-on: ubuntu-latest
steps:
Expand Down
62 changes: 40 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,53 @@
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
(flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
poetry2nix,
}:
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = (import nixpkgs {
inherit system;
config = { };
overlays = [
poetry2nix.overlays.default
];
});
overrides = pkgs.poetry2nix.overrides.withDefaults (self: super:
pkgs = (
import nixpkgs {
inherit system;
config = { };
overlays = [
poetry2nix.overlays.default
];
}
);
overrides = pkgs.poetry2nix.overrides.withDefaults (
self: super:
let
buildSystems = {
durations = [ "setuptools" ];
multitail2 = [ "setuptools" ];
pytest-github-actions-annotate-failures = [ "setuptools" ];
flake8-black = [ "setuptools" ];
flake8-isort = [ "hatchling" ];
docker = [ "hatchling" "hatch-vcs" ];
docker = [
"hatchling"
"hatch-vcs"
];
};
in
pkgs.lib.mapAttrs
(attr: systems: super.${attr}.overridePythonAttrs
(old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
}))
buildSystems
pkgs.lib.mapAttrs (
attr: systems:
super.${attr}.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
})
) buildSystems
);
in
rec {
packages.default = pkgs.poetry2nix.mkPoetryApplication
{
projectDir = ./.;
inherit overrides;
};
packages.default = pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
inherit overrides;
};
apps.default = {
type = "app";
program = "${packages.default}/bin/pystarport";
Expand All @@ -53,6 +65,12 @@
projectDir = ./.;
inherit overrides;
})
(pkgs.poetry2nix.mkPoetryEditablePackage {
projectDir = ./.;
editablePackageSources = {
pystarport = ./pystarport;
};
})
];
};
}
Expand Down
6 changes: 4 additions & 2 deletions pystarport/tests/test_expansion/test_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def test_expansion(type, func):
}
}

path = Path(__file__).parent

# overriding dotenv with absolute path is expanded and has diff
dotenv = os.path.abspath("test_expansion/dotenv1")
dotenv = os.path.abspath(path / "dotenv1")
config = func(cronos_has_dotenv, dotenv)
assert DeepDiff(
base_config,
Expand All @@ -72,7 +74,7 @@ def test_expansion(type, func):
}

# overriding dotenv with absolute path is expanded and no diff
dotenv = os.path.abspath("test_expansion/dotenv")
dotenv = os.path.abspath(path / "dotenv")
config = func(cronos_has_posix_no_dotenv, dotenv)
assert not DeepDiff(
base_config,
Expand Down
Loading