示例#1
0
    def run(self):
        cov = None
        if self.coverage:
            import coverage
            omit = ["/usr/*", "/*/tests/*"]
            cov = coverage.coverage(omit=omit)
            cov.erase()
            if not self._external_coverage:
                cov.start()

        import tests as testsmodule
        testsmodule.utils.clistate.regenerate_output = bool(
            self.regenerate_output)
        testsmodule.utils.clistate.use_coverage = bool(cov)
        testsmodule.utils.clistate.debug = bool(self.debug)
        testsmodule.setup_logging()
        testsmodule.setup_cli_imports()

        # This makes the test runner report results before exiting from ctrl-c
        unittest.installHandler()

        tests = unittest.TestLoader().loadTestsFromNames(self._testfiles)
        if self.only:
            newtests = []
            for suite1 in tests:
                for suite2 in suite1:
                    for testcase in suite2:
                        if self.only in str(testcase):
                            newtests.append(testcase)

            if not newtests:
                print("--only didn't find any tests")
                sys.exit(1)
            tests = unittest.TestSuite(newtests)
            print("Running only:")
            for test in newtests:
                print("%s" % test)
            print("")

        verbosity = 1
        if self.debug or self.testverbose or self._force_verbose:
            verbosity = 2
        t = unittest.TextTestRunner(verbosity=verbosity)

        try:
            result = t.run(tests)
        except KeyboardInterrupt:
            sys.exit(1)

        if cov:
            if self._external_coverage:
                cov.load()
            else:
                cov.stop()
                cov.save()

        err = int(bool(len(result.failures) > 0 or len(result.errors) > 0))
        if cov and not err:
            cov.report(show_missing=False)
        sys.exit(err)
示例#2
0
def pytest_configure(config):
    TESTCONFIG.url_iso_only = config.getoption("--urls-iso-only")
    TESTCONFIG.url_only = config.getoption("--urls-url-only")
    TESTCONFIG.url_skip_libosinfo = config.getoption("--urls-skip-libosinfo")
    TESTCONFIG.url_force_libosinfo = config.getoption("--urls-force-libosinfo")
    TESTCONFIG.regenerate_output = config.getoption("--regenerate-output")

    TESTCONFIG.debug = config.getoption("--log-level") == "debug"
    tests.setup_logging()
示例#3
0
        import pytest
        pytest.main(["--pyargs", __file__])
    except ImportError:
        print("'py.test' unit testing framework not available. Can not run "
            "'{}' directly as a script.".format(__file__))
    import sys
    sys.exit(-2)


from suds.sax.date import Timezone
import suds.xsd.sxbuiltin
import tests

import datetime

tests.setup_logging()


class Date(suds.xsd.sxbuiltin.XDate):
    def __init__(self):
        pass


class Time(suds.xsd.sxbuiltin.XTime):
    def __init__(self):
        pass


class DateTime(suds.xsd.sxbuiltin.XDateTime):
    def __init__(self):
        pass
示例#4
0
文件: public.py 项目: uhla/suds-sw
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# written by: Jeff Ortel ( [email protected] )

import sys
sys.path.insert(0, '../')

import logging
import traceback as tb
import suds.metrics as metrics
from tests import setup_logging
from suds import WebFault
from suds.client import Client

errors = 0

setup_logging()

# logging.getLogger('suds.client').setLevel(logging.DEBUG)
# logging.getLogger('suds.metrics').setLevel(logging.DEBUG)
# logging.getLogger('suds').setLevel(logging.DEBUG)


def start(url):
    global errors
    print(
        '\n________________________________________________________________\n')
    print('Test @ ( %s ) %d' % (url, errors))


try:
    url = 'http://www.swsoft.com/webservices/vza/4.0.0/VZA.wsdl'
示例#5
0
文件: public.py 项目: ticosax/suds-ng
# written by: Jeff Ortel ( [email protected] )

import sys

sys.path.insert(0, "../")

import logging
import traceback as tb
import suds.metrics as metrics
from tests import setup_logging
from suds import WebFault
from suds.client import Client

errors = 0

setup_logging()

# logging.getLogger('suds.client').setLevel(logging.DEBUG)
# logging.getLogger('suds.metrics').setLevel(logging.DEBUG)
# logging.getLogger('suds').setLevel(logging.DEBUG)


def start(url):
    global errors
    print("\n________________________________________________________________\n")
    print("Test @ ( %s ) %d" % (url, errors))


try:
    url = "http://www.swsoft.com/webservices/vza/4.0.0/VZA.wsdl"
    start(url)
示例#6
0
    try:
        import pytest
        pytest.main(["--pyargs", __file__])
    except ImportError:
        print("'py.test' unit testing framework not available. Can not run "
            "'{}' directly as a script.".format(__file__))
    import sys
    sys.exit(-2)


import datetime
from suds.sax.date import Timezone
import suds.xsd.sxbuiltin
import tests

tests.setup_logging()


class Date(suds.xsd.sxbuiltin.XDate):
    def __init__(self):
        pass

class Time(suds.xsd.sxbuiltin.XTime):
    def __init__(self):
        pass

class DateTime(suds.xsd.sxbuiltin.XDateTime):
    def __init__(self):
        pass

示例#7
0
    def run(self):
        cov = None
        if self.coverage:
            import coverage
            omit = ["/usr/*", "/*/tests/*", "*progress.py"]
            cov = coverage.coverage(omit=omit)
            cov.erase()
            if not self._external_coverage:
                cov.start()

        import tests as testsmodule
        testsmodule.utils.clistate.regenerate_output = bool(
            self.regenerate_output)
        testsmodule.utils.clistate.use_coverage = bool(cov)
        testsmodule.utils.clistate.debug = bool(self.debug)
        for key, val in self._clistate.items():
            setattr(testsmodule.utils.clistate, key, val)
        testsmodule.setup_logging()
        if self._urlfetcher_mock:
            import tests.urlfetcher_mock
            tests.urlfetcher_mock.setup_mock()

        # This makes the test runner report results before exiting from ctrl-c
        unittest.installHandler()

        tests = unittest.TestLoader().loadTestsFromNames(self._testfiles)
        if self.only:
            newtests = []
            for suite1 in tests:
                for suite2 in suite1:
                    for testcase in suite2:
                        if self.only in str(testcase):
                            newtests.append(testcase)

            if not newtests:
                print("--only didn't find any tests")
                sys.exit(1)
            tests = unittest.TestSuite(newtests)
            print("Running only:")
            for test in newtests:
                print("%s" % test)
            print("")

        verbosity = 1
        if self.debug or self.testverbose or self._force_verbose:
            verbosity = 2
        t = unittest.TextTestRunner(verbosity=verbosity)

        try:
            result = t.run(tests)
        except KeyboardInterrupt:
            sys.exit(1)

        if cov:
            if self._external_coverage:
                cov.load()
            else:
                cov.stop()
                cov.save()

        err = int(bool(len(result.failures) > 0 or len(result.errors) > 0))
        if getattr(result, "shouldStop", False):
            # Test was aborted with ctrl-c
            err = True

        if cov and not err:
            if len(result.skipped):
                print("Skipping coverage report because tests were skipped.")
            else:
                cov.report(show_missing=False, skip_covered=True)
        sys.exit(err)
示例#8
0
    def run(self):
        cov = None
        if self.coverage:
            import coverage
            omit = ["/usr/*", "/*/tests/*"]
            cov = coverage.coverage(omit=omit)
            cov.erase()
            if not self._external_coverage:
                cov.start()

        import tests as testsmodule
        testsmodule.utils.clistate.regenerate_output = bool(
                self.regenerate_output)
        testsmodule.utils.clistate.use_coverage = bool(cov)
        testsmodule.utils.clistate.debug = bool(self.debug)
        testsmodule.setup_logging()
        testsmodule.setup_cli_imports()

        # This makes the test runner report results before exiting from ctrl-c
        unittest.installHandler()

        tests = unittest.TestLoader().loadTestsFromNames(self._testfiles)
        if self.only:
            newtests = []
            for suite1 in tests:
                for suite2 in suite1:
                    for testcase in suite2:
                        if self.only in str(testcase):
                            newtests.append(testcase)

            if not newtests:
                print("--only didn't find any tests")
                sys.exit(1)
            tests = unittest.TestSuite(newtests)
            print("Running only:")
            for test in newtests:
                print("%s" % test)
            print("")

        verbosity = 1
        if self.debug or self.testverbose or self._force_verbose:
            verbosity = 2
        t = unittest.TextTestRunner(verbosity=verbosity)

        try:
            result = t.run(tests)
        except KeyboardInterrupt:
            sys.exit(1)

        if cov:
            if self._external_coverage:
                cov.load()
            else:
                cov.stop()
                cov.save()

        err = int(bool(len(result.failures) > 0 or
                       len(result.errors) > 0))
        if cov and not err:
            cov.report(show_missing=False)
        sys.exit(err)