glideinwms.unittests package

Submodules

glideinwms.unittests.profile_frontend module

class glideinwms.unittests.profile_frontend.FakeLogger(afile=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>)[source]

Bases: object

Super simple logger for the unittests

debug(msg, *args)[source]

Pass a debug message to stderr.

Prints out msg % args.

@param msg: A message string. @param args: Arguments which should be evaluated into the message.

error(msg, *args)[source]

Pass an error message to stderr.

@see: debug

exception(msg, *args)[source]

Pass an exception message to stderr.

@see: debug

info(msg, *args)[source]

Pass an info-level message to stderr.

@see: debug

warning(msg, *args)[source]

Pass a warning-level message to stderr.

@see: debug

glideinwms.unittests.profile_frontend.main()[source]
class glideinwms.unittests.profile_frontend.mock_condorq_el(obj)[source]

Bases: object

fetchStored()[source]

glideinwms.unittests.test_OSG_autoconf module

glideinwms.unittests.test_cleanupSupport module

glideinwms.unittests.test_creation_lib_cWDictFile_DictFile module

glideinwms.unittests.test_creation_lib_cWDictFile_DictFileTwoKeys module

glideinwms.unittests.test_creation_lib_cWDictFile_DictFileTwoKeys_SubClasses module

glideinwms.unittests.test_creation_lib_cWDictFile_SHADicts module

glideinwms.unittests.test_creation_lib_cWDictFile_validate_node module

glideinwms.unittests.test_creation_lib_cgWConsts module

glideinwms.unittests.test_creation_lib_cgWCreate module

Project: glideinwms File: test_creation_lib_cgWCreate.py Purpose: unit test of glideinwms/creation/lib/cgWCreate.py Author: Dennis Box, dbox@fnal.gov

class glideinwms.unittests.test_creation_lib_cgWCreate.TestGlideinSubmitDictFile(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_populate()[source]
test_populate_standard_grid()[source]

glideinwms.unittests.test_creation_lib_cgWDictFile module

glideinwms.unittests.test_creation_lib_cgWParamDict module

glideinwms.unittests.test_creation_lib_cgWParams module

glideinwms.unittests.test_creation_lib_cvWConsts module

glideinwms.unittests.test_creation_lib_cvWCreate module

glideinwms.unittests.test_creation_lib_cvWParamDict module

glideinwms.unittests.test_creation_lib_cvWParams module

glideinwms.unittests.test_creation_lib_factoryXmlConfig module

glideinwms.unittests.test_factory_glideFactoryConfig module

glideinwms.unittests.test_factory_glideFactoryEntry module

glideinwms.unittests.test_factory_glideFactoryLib module

glideinwms.unittests.test_factory_glideFactoryLogParser module

glideinwms.unittests.test_frontend module

glideinwms.unittests.test_frontend_element module

glideinwms.unittests.test_frontend_glideinFrontendConfig module

glideinwms.unittests.test_frontend_glideinFrontendElement module

glideinwms.unittests.test_glideFactoryDowntimeLib module

glideinwms.unittests.test_glideinFrontendPlugins module

glideinwms.unittests.test_lib_DiskCache module

glideinwms.unittests.test_lib_condorExe module

glideinwms.unittests.test_lib_disk_cache module

glideinwms.unittests.test_lib_exprParser module

glideinwms.unittests.test_lib_fork module

glideinwms.unittests.test_lib_pubCrypto module

glideinwms.unittests.test_lib_servicePerformance module

glideinwms.unittests.test_lib_symCrypto module

glideinwms.unittests.test_lib_timeConversion module

glideinwms.unittests.test_lib_x509Support module

glideinwms.unittests.test_lib_xmlParse module

glideinwms.unittests.test_logSupport module

glideinwms.unittests.test_renew_proxy module

glideinwms.unittests.test_tarSupport module

glideinwms.unittests.test_util module

glideinwms.unittests.unittest_utils module

class glideinwms.unittests.unittest_utils.FakeLogger(afile=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>)[source]

Bases: object

Super simple logger for the unittests

debug(msg, *args)[source]

Pass a debug message to stderr.

Prints out msg % args.

@param msg: A message string. @param args: Arguments which should be evaluated into the message.

error(msg, *args)[source]

Pass an error message to stderr.

@see: debug

exception(msg, *args)[source]

Pass an exception message to stderr.

@see: debug

info(msg, *args)[source]

Pass an info-level message to stderr.

@see: debug

warning(msg, *args)[source]

Pass a warning-level message to stderr.

@see: debug

exception glideinwms.unittests.unittest_utils.TestImportError(err_msg='Error')[source]

Bases: Exception

Error handler for import errors in this test suite If import of package listed in handled_import_errors fails, print out hopefully informative message and exit 0

glideinwms.unittests.unittest_utils.balanced_text(myText)[source]

checks line by line that parens and quotations are balanced :param myText: contents of a text file, multi-line string

Returns:

string, “Balanced” if no problems found
”Unbalanced, line x” if a problem was found

on line x of text

glideinwms.unittests.unittest_utils.create_random_string(length=8)[source]
glideinwms.unittests.unittest_utils.create_temp_file(file_suffix='', file_prefix='tmp', file_dir='/tmp', text_access=True, write_path_to_file=True)[source]
glideinwms.unittests.unittest_utils.runAllTests()[source]

We assume that this particular module is in the unittest directory Search the unittest directory for all files matching test_*.py. Attempt to import main() execute main()

What kinds of safety checks do we need here?

glideinwms.unittests.unittest_utils.runTest(cls)[source]

Given a test class, generate and run a test suite

@param cls: Test class to use to generate a test suite. It is assumed

that the constructor for this class has signature cls(cp, site_name). If per_site=False, then the signature is assumed to be cls().

@type cls: class

Module contents

  • Unittests should be placed in glideinWMS/unittests

  • Unittests are branch/tag specific. This allows the unittests to test for

    features that a specific tag or branch has but not other branches/tags. Once a feature is merged to head (and/or the current release branch), the corresponding unittest should be merged as well.

  • Unless there is a compelling reason, the unittest should never call a binary

    outside the glideinWMS codebase. In order to create accurate tests, all inputs should be well defined and “known”. All outputs should be derived from the inputs. If you need output from outside sources, consider creating a “worker script” that returns known sample output. Place the “worker script” in glideinWMS/unittests/worker_scripts.

  • All unittest file names must follow the following convention:

    test_<your name>.py

    unittest_utils.py contains a function that will trigger all unittests that follow the file naming convention.

  • All unittests should import unittest_utils. This will setup the appropriate

    PYTHON_PATH for glideinWMS. After the unittest import, all other imports can proceed as normal without having to specify or append to PYTHON_PATH.

    Note: NMI will separate the unittest location from the source location. It defines $GLIDEINWMS_LOCATION. unittest_utils.py handles this for you.

  • All unittests must have the following code appended:
    def main():

    return runTest(<Unittest Class>)

    if __name__ == ‘__main__’:

    sys.exit(main())

    The main function will be executed both when you directly run the unittest and when unittest_utils.runAllTests() funtion is called. Replace <Unittest Class> with the class name.