diff --git a/build.sh b/build.sh index 6a91ff3d..63c380cf 100755 --- a/build.sh +++ b/build.sh @@ -126,6 +126,12 @@ case "$1" in | xargs rm -f ;; + t) + shift # skip t + PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ + python3 -m unittest "$@" + ;; + test) PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ python3 -m cdist.test diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index f96da0de..005f1bb0 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,6 +1,7 @@ 2.0.3: -- fix emulator +- fix emulator / require +- sanity checks -------------------------------------------------------------------------------- diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 722b6b6b..f0c867e1 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,35 +1,3 @@ -Object: +Code fixes needed: - -Type: - type.transferred_explorers - - -GlobalExplorer: - out_path: local path into which the output is written - - cdist.core.GlobalExplorer.base_dir - local directory containing explorers - cdist.core.GlobalExplorer.remote_base_dir - remote directory containing explorers - - path: local path to explorer - remote_path: remote path to explorer - - See config_install: run_global_explorers() - -Object/Type: - - rutern relative only - - Have accept absulet path on listing - -Tests needed: - - - Fail if cache_dir from previous run cannot be deleted - - Fail if cache_dir cannot be created from current out_dir - - transfer_type_explorers: Explorers are not transferred twice - - transfer_type_explorers: No transfer tried if there are no type_explorers - - - does $require work? - - $whatever should fail if there is no global explorer directory - - emulator may only be called with __ as prefix - fail otherwise! - - - ensure paths returned by object include dot-cdist - - ensure path of explorer of object returns correct path + - shutil, os.mkdir, etc. everywhere: catch/reraise exceptions correctly diff --git a/doc/dev/todo/tests b/doc/dev/todo/tests new file mode 100644 index 00000000..8f019fed --- /dev/null +++ b/doc/dev/todo/tests @@ -0,0 +1,28 @@ +Tests needed: + + - Fail if cache_dir from previous run cannot be deleted + - Fail if cache_dir cannot be created from current out_dir + - transfer_type_explorers: Explorers are not transferred twice + - transfer_type_explorers: No transfer tried if there are no type_explorers + + - does $require work? + - $whatever should fail if there is no global explorer directory + - emulator may only be called with __ as prefix - fail otherwise! + + - ensure paths returned by object include dot-cdist + - ensure path of explorer of object returns correct path + + config_install: + run_type_manifest() - same tests as for test_initial_manifest_*? + run_manifest() - raise exception if manifest is not existent + object_run(): ensure no object is run twice + object_run(): ensure requirements are taken into account + object_run(): check (from extern?) that all needed variables are setup + object_run(): ensure no code-{local, remote} is created, if gencode is not producing code + object_run(): ensure no code-{local, remote} contains what gencode created + + run_type_explorer(): ensure output is saved to correct path + run_type_explorer(): ensure a type with no explorers works + run_type_explorer(): ensure environment is setup correctly + + diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 7aca5ac7..a3dc01cc 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -19,8 +19,23 @@ # # -VERSION = "2.0.3" +BANNER = """ + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . z` ^% :8 - '88bu. %8P . . +# +# + +import io +import sys +import unittest + +import cdist +import cdist.banner + +class Banner(unittest.TestCase): + def setUp(self): + self.banner = cdist.BANNER + "\n" + + def test_banner_output(self): + """Check that printed banner equals saved banner""" + output = io.StringIO() + + sys.stdout = output + + cdist.banner.banner(None) + + self.assertEqual(output.getvalue(), self.banner)