mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-23 00:13:02 +03:00
tests: fix unit tests, fix extended examples
This commit is contained in:
parent
fe38f28ba8
commit
55db7931ce
@ -1,9 +1,9 @@
|
||||
{dlib, ...}: {
|
||||
{config, ...}: {
|
||||
discoverers.dummy = rec {
|
||||
name = "dummy";
|
||||
subsystem = "hello";
|
||||
discover = {tree}: [
|
||||
(dlib.construct.discoveredProject {
|
||||
(config.dlib.construct.discoveredProject {
|
||||
inherit subsystem name;
|
||||
inherit (tree) relPath;
|
||||
translators = ["dummy"];
|
||||
|
@ -42,8 +42,8 @@
|
||||
}
|
||||
'')
|
||||
(builtins.toFile "crates-io-new.nix" ''
|
||||
{lib, ...}: {
|
||||
fetchers.crates-io = lib.mkForce {
|
||||
{config, ...}: {
|
||||
fetchers.crates-io = config.lib.mkForce {
|
||||
imports = ["${inp.dream2nix}/src/fetchers/crates-io"];
|
||||
};
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ in let
|
||||
inherit dlib;
|
||||
inherit externals;
|
||||
inherit externalSources;
|
||||
inherit fetchers;
|
||||
inherit framework;
|
||||
inherit indexers;
|
||||
inherit dream2nixWithExternals;
|
||||
@ -97,9 +96,6 @@ in let
|
||||
# apps for CLI and installation
|
||||
apps = callPackageDream ./apps {};
|
||||
|
||||
# fetcher implementations
|
||||
fetchers = callPackageDream ./fetchers {};
|
||||
|
||||
# indexer implementations
|
||||
indexers = callPackageDream ./indexers {};
|
||||
|
||||
|
@ -5,7 +5,7 @@ import pytest
|
||||
|
||||
def get_projects_to_test():
|
||||
tests = nix_ffi.eval(
|
||||
'subsystems.allTranslators',
|
||||
'framework.translators',
|
||||
wrapper_code = '''
|
||||
{result, ...}: let
|
||||
lib = (import <nixpkgs> {}).lib;
|
||||
@ -23,7 +23,7 @@ def get_projects_to_test():
|
||||
})
|
||||
(translator.generateUnitTestsForProjects or [])
|
||||
)
|
||||
result
|
||||
(l.attrValues result)
|
||||
)
|
||||
''',
|
||||
)
|
||||
@ -65,7 +65,7 @@ def check_format_sourceSpec(sourceSpec):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_packageName(p):
|
||||
defaultPackage = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -81,7 +81,7 @@ def test_packageName(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_exportedPackages(p):
|
||||
exportedPackages = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateınstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -97,7 +97,7 @@ def test_exportedPackages(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_extraObjects(p):
|
||||
extraObjects = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -121,7 +121,7 @@ def test_extraObjects(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_location(p):
|
||||
location = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -136,7 +136,7 @@ def test_location(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_serializedRawObjects(p):
|
||||
serializedRawObjects = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -159,7 +159,7 @@ def test_serializedRawObjects(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_subsystemName(p):
|
||||
subsystemName = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -175,7 +175,7 @@ def test_subsystemName(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_subsystemAttrs(p):
|
||||
subsystemAttrs = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -191,7 +191,7 @@ def test_subsystemAttrs(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_translatorName(p):
|
||||
translatorName = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -207,7 +207,7 @@ def test_translatorName(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_extractors(p):
|
||||
finalObjects = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
@ -241,7 +241,7 @@ def test_extractors(p):
|
||||
@pytest.mark.parametrize("p", projects)
|
||||
def test_keys(p):
|
||||
objectsByKey = nix_ffi.eval(
|
||||
f"subsystems.{p['subsystem']}.translators.{p['translator']}.translate",
|
||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateInstanced",
|
||||
params=dict(
|
||||
project=p['project'],
|
||||
source=p['source'],
|
||||
|
@ -68,7 +68,7 @@ import nix_ffi
|
||||
])
|
||||
def test_translateShortcut(shortcut, expected):
|
||||
result = nix_ffi.callNixFunction(
|
||||
'fetchers.translateShortcut',
|
||||
'framework.functions.fetchers.translateShortcut',
|
||||
shortcut=shortcut,
|
||||
computeHash=False,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user