From d42f118ad67c18c8f23c3c30245b739aa359166c Mon Sep 17 00:00:00 2001 From: Ronny Abraham Date: Thu, 15 Sep 2016 21:27:23 +0300 Subject: [PATCH] got rid of unnecesary testing directory --- modules/testing/__init__.py | 1 - modules/testing/__init__.pyc | Bin 206 -> 0 bytes modules/testing/configuration_setup.py | 181 ------------------------- modules/testing/maintenance.pyc | Bin 4220 -> 0 bytes 4 files changed, 182 deletions(-) delete mode 100644 modules/testing/__init__.py delete mode 100644 modules/testing/__init__.pyc delete mode 100644 modules/testing/configuration_setup.py delete mode 100644 modules/testing/maintenance.pyc diff --git a/modules/testing/__init__.py b/modules/testing/__init__.py deleted file mode 100644 index f38bba0..0000000 --- a/modules/testing/__init__.py +++ /dev/null @@ -1 +0,0 @@ -import maintenance diff --git a/modules/testing/__init__.pyc b/modules/testing/__init__.pyc deleted file mode 100644 index 5f6c072876c3f3369670a0ed15b077ca1cc67e04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 206 zcmYLDK?=e^4BYBP6v1co)Oe@UuQZQxzPN$%Gj~rqAX4 z5$WX34-=hRZCNP=t-@T5Ie)~y99?=Tc4eV5FO+VMI3qjuSn6v2Bu8E0AeaPFWFDYP zu|=N+LhHDR5U_R`#bRFtyo2~eow^rSC-QKMp}(SlCNgmY))G^;w(5pF)6?s3U^BiV G+U5;$8#b8$ diff --git a/modules/testing/configuration_setup.py b/modules/testing/configuration_setup.py deleted file mode 100644 index 10c58d9..0000000 --- a/modules/testing/configuration_setup.py +++ /dev/null @@ -1,181 +0,0 @@ -from fabric.api import task, env -from fabric.operations import run -import os -import modules.utils as utils - -from modules.conf import create_dir_top -from modules.conf import exists_dir_top -from modules.conf import exists_dir_sub -from modules.conf import exists_file - -# import modules.conf as conf - - -@task -def test(*args, **kwargs): - """ - Test functions in conf - - Keyword Arguments: - - funcname -- name of testing function to run - """ - # configuration = env.config - - # dictionary of legitimate functions that can be tested - # when given the param name - test_values = { - 'conf_top': test_conf_top, - 'conf_sub': test_conf_sub, - 'conf_file': test_conf_file, - } - - funcname = kwargs.get('funcname') - - if not funcname: - if len(args) > 0: - funcname = args[0] - args = args[1:] - - if funcname in test_values.keys(): - test_values[funcname](*args, **kwargs) - - else: - print "\nTest functions in this module, acceptable values include:" - for val in test_values: - print val - - -def test_conf_file(*args, **kwargs): - SPACING = "\n" - utils.print_console("testing exist_conf_file", - prepend=SPACING, append=SPACING) - - confargument = kwargs.get('conf') - if not confargument: - confargument = args[0] if len(args) > 0 else None - - exists_file(confargument) - - -def test_conf_sub(*args, **kwargs): - SPACING = "\n" - utils.print_console("testing exist_conf_sub", - prepend=SPACING, append=SPACING) - - confargument = kwargs.get('conf') - if not confargument: - confargument = args[0] if len(args) > 0 else None - - exists_dir_sub(confargument) - - -def test_conf_top(*args, **kwargs): - configuration = env.config - SPACING = "\n" - - utils.print_console("testing exists_conf", - prepend=SPACING, append=SPACING) - - utils.printvar("exists_dir_top", - exists_dir_top()) - - utils.print_console("testing create_dir_top", - prepend=SPACING, append=SPACING) - - if exists_dir_top(): - - msg = "conf directory already exists, move conf to a temporary " \ - "directory, and test out the create_dir_top function." - utils.print_console(msg, prepend=SPACING, append=SPACING, sep=None) - - # - # command to create a temporary directory and echo it's name - # back to stdout, so we can store that name for use - - cmd_mktmp = "mytmpdir=`mktemp -d 2>/dev/null ||" \ - " mktemp -d -t 'mytmpdir'`" - cmd_mktmp = cmd_mktmp + "; echo $mytmpdir" - - # - # create a temporary diretory to store old conf files - - tmpdir = run(cmd_mktmp) - - # - # make sure we are working with a legit path - # otherwise, just kick out. - - with utils.virtualenv(): - cmd_py_isdir = "python -c \"import os; "\ - "print os.path.isdir('%s')\"" % \ - configuration.paths.conf.remote - - # - # take the output from this command and booleanize it - - output = run(cmd_py_isdir) - is_dir = utils.booleanize(output) - utils.printvar("is_dir", is_dir) - - if is_dir: - lastpart = os.path.basename(configuration.paths.conf.remote) - - path_conf_tmp = os.path.join(tmpdir, lastpart) - else: - - utils.printvar("configuration.paths.conf.remote", - configuration.paths.conf.remote) - - msg = "the original configuration path is NOT a path." \ - "Continue? y/N" - - utils.prompt_continue(message=msg, default="N") - - # - # now move the original configuration directory to the temporary - # location, and run test running create_dir_top on an empty - - msg = "moving original conf directory." - utils.print_console(msg, prepend=SPACING, append=SPACING, sep=None) - - cmd_mvtmp = "mv %s %s" % \ - (configuration.paths.conf.remote, path_conf_tmp) - - run(cmd_mvtmp) - - # - # create the new conf directory - - msg = "creating new conf directory." - utils.print_console(msg, prepend=SPACING, append=SPACING, sep=None) - create_dir_top() - - # - # testing on empty location completed, remove the current directory - # and move back the original - - msg = "removing created directory." - utils.print_console(msg, prepend=SPACING, append=SPACING, sep=None) - - cmd_rm_created = "rm -Rf %s" % configuration.paths.conf.remote - run(cmd_rm_created) - - # - # returning original directory - - msg = "Moving back original directory." - utils.print_console(msg, prepend=SPACING, append=SPACING, sep=None) - - cmd_return_orig = "mv %s %s" % \ - (path_conf_tmp, configuration.paths.conf.remote) - - run(cmd_return_orig) - - cmd_rmtmp = "rm -Rf %s" % tmpdir - run(cmd_rmtmp) - else: - msg = "conf directory does not exist, test out create_dir_top" - utils.print_console(msg, prepend=SPACING, append=SPACING, sep=None) - - create_dir_top() diff --git a/modules/testing/maintenance.pyc b/modules/testing/maintenance.pyc deleted file mode 100644 index e4c7bf7f5fa483c7afb35a2095b571816b7f16b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4220 zcmd5ei?O0xU z-?B4OPL%uw^OfT_z#rhp@dM!LUcK0Nxhj7lg>8+dXL@@2<>~2m?cW{mZwG&RF{0&< zgYTc?WB!F9!k?mqC{;96lsYtYNb#yeNsZDi8g5l|jgmSI>v95fmnIDwHiX=wWSi0^ z4Vx8fU1*PnUPZe?w`ka^=!Vd38n#JkMbS3>mFN-*bSP@_e7HlACzCEkEt%|6RHNs; zHgt~vgP$IoVYhe)&AF{%qO(~~@d6X&G&`!O+n`3J4y`^O<=N?R6qm;~FE*R{%h*_R z!%Z_is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