List of test suite names available in this project
166967
def suites(self, request, pk=None):
        
        suites_names = self.get_object().suites.values_list('slug')
        suites_metadata = SuiteMetadata.objects.filter(kind='suite', suite__in=suites_names)
        page = self.paginate_queryset(suites_metadata)
        serializer = SuiteMetadataSerializer(page, many=True, context={'request': request})
        return self.get_paginated_response(serializer.data)
1346762
def find_project(self):  # type: () -> List[str]
        
        folders = [f for f in os.listdir(".") if os.path.isdir(f)]

        candidates = []
        setup = self.setup_py_source()
        for folder in folders:
            if os.path.isfile(folder + "/__init__.py"):
                dunder_source = self._read_file(folder + "/__init__.py")
                project = folder
                if setup:
                    # prevents test folders & other junk
                    in_setup = (
                        "'{0}".format(project) not in setup
                        and '"{0}"'.format(project) not in setup
                    )
                    in_dunder = (
                        "'{0}".format(dunder_source) not in setup
                        and '"{0}"'.format(dunder_source) not in setup
                    )

                    if not in_setup and not in_dunder:
                        continue

                candidates.append(folder)

        # TODO: parse setup.cfg
        if not candidates:
            candidates = candidates + self.find_single_file_project()
        if not candidates:
            candidates = candidates + self.find_malformed_single_file_project()

        candidates = list(set([x for x in candidates if x]))

        # too many
        if not candidates:
            candidates.extend(self.via_find_packages())
            candidates = list(set([x for x in candidates if x]))

        if len(candidates) > 1:
            for unlikely in [
                "test",
                "tests",
                "example",
                "examples",
                "demo",
                "demos",
                "test_files",
            ]:
                if unlikely in candidates:
                    logger.warning("Assuming {0} is not the project".format(unlikely))
                    candidates.remove(unlikely)
                if len(candidates) == 1:
                    break

        # too few or too many
        if len(candidates) != 1:
            likely_name = self.name_from_setup_py()
            if likely_name in candidates:
                return [likely_name]
        return list(set([x for x in candidates if x]))
391794
function(test) {
  var base = tapeTemps.base({
    testTitle: test.testTitle
  });
  var plan = tapeTemps.plan({
    assertions: test.assertions.length
  });
  return base + indent + plan + _renderAssertions(test.assertions) + '});' + eol;
}
314357
def checklist(ctx):
    """"""
    checklist = """PRE-RELEASE CHECKLIST:
[ ]  Everything is checked in
[ ]  All tests pass w/ tox

RELEASE CHECKLIST:
[{x1}]  Bump version to new-version and tag repository (via bump_version)
[{x2}]  Build packages (sdist, bdist_wheel via prepare)
[{x3}]  Register and upload packages to testpypi repository (first)
[{x4}]    Verify release is OK and packages from testpypi are usable
[{x5}]  Register and upload packages to pypi repository
[{x6}]  Push last changes to Github repository

POST-RELEASE CHECKLIST:
[ ]  Bump version to new-develop-version (via bump_version)
[ ]  Adapt CHANGES (if necessary)
[ ]  Commit latest changes to Github repository
"""
    steps = dict(x1=None, x2=None, x3=None, x4=None, x5=None, x6=None)
    yesno_map = {True: "x", False: "_", None: " "}
    answers = {name: yesno_map[value]
               for name, value in steps.items()}
    print(checklist.format(**answers))
779817
def main():
    
    # Parse command line arguments
    args = get_args()

    # Instantiate the TestRail client
    # Use the CLI argument to identify which project to work with
    tr = TestRail(project_dict[args.project])

    # Get a reference to the current project
    project = tr.project(project_dict[args.project])

    # To create a new run in TestRail, first create a new, blank run
    # Update the new run with a name and project reference
    new_run = tr.run()
    new_run.name = "Creating a new Run through the API"
    new_run.project = project
    new_run.include_all = True  # All Cases in the Suite will be added as Tests

    # Add the run in TestRail. This creates the run, and returns a run object
    run = tr.add(new_run)

    print("Created new run: {0}".format(run.name))

    # Before starting the tests, lets pull in the Status objects for later
    PASSED = tr.status('passed')
    FAILED = tr.status('failed')
    BLOCKED = tr.status('blocked')

    # Get a list of tests associated with the new run
    tests = list(tr.tests(run))

    print("Found {0} tests".format(len(tests)))

    # Execute the tests, marking as passed, failed, or blocked
    for test_num, test in enumerate(tests):
        print("Executing test #{0}".format(test_num))
        # Run your tests here, reaching some sort of pass/fail criteria
        # This example will pick results at random and update the tests as such

        test_status = random.choice([PASSED, FAILED, BLOCKED])

        print("Updating test  #{0} with a status of {1}".format(test_num,
                                                               test_status.name))

        # Create a blank result, and associate it with a test and a status
        result = tr.result()
        result.test = test
        result.status = test_status
        result.comment = "The test case was udpated via a script"

        # Add the result to TestRail
        tr.add(result)

    # All tests have been executed. Close this test run
    print("Finished, closing the run")
    tr.close(run)
286112
function(results, run, options, done) {

    _.each(results, function(result) {

      var pkg = {
        name: result.testsuites.$.name,
        tests: parse(result.testsuites.$.tests),
        failures: parse(result.testsuites.$.failures),
        suites: []
      };
      pkg.isFailure = pkg.failures > 0;

      var filename = result.filename;
      _.each(result.testsuites.testsuite, function(suiteData) {
        var $ = suiteData.$;

        var suite = {
          name: $.name,
          pkgName: $.package,
          failures: parse($.failures),
          errors: parse($.errors),
          skipped: parse($.skipped),
          tests: parse($.tests),
          cases: []
        };

        // Sometimes the package name isn't in the
        // xml reports...
        if (!pkg.name) {
          if (result.testsuites.filename) {
            pkg.name = result.testsuites.filename;
          } else {
            pkg.name = suite.pkgName;
          }
        } else {
          if (result.testsuites.filename) {
            pkg.name = result.testsuites.filename + '-' + pkg.name;
          }
        }

        suite.passed = suite.tests - suite.errors - suite.failures;
        suite.isFailure = suite.errors > 0 || suite.failures > 0;
        suite.errmessages = $['system-err'];
        pkg.suites.push(suite);

        _.each(suiteData.testcase, function(caseData) {

          var assert = {
            message: caseData.$.name,
            time: caseData.$.time,
            stacktrace: '',
            failure: false,
            skipped: false,
            screenshots: []

            // failure: false or failure message,
            // screenshots: ['path/to/screen1', '/path/to/screen2']
          };

          if (caseData.skipped)
            assert.skipped = true;

          if (caseData.failure && caseData.failure.length > 0)
            assert.failure = caseData.failure[0].$.message;

          if (caseData['system-out']) {
            var sspaths = getScreenshotPaths(caseData['system-out']);

            sspaths.map(function(sspath) {
              if (options.relativeScreenshots) {
                sspath = getRelativePath(options.fullOutputFilename, sspath);
              }
              assert.screenshots.push(sspath);
            });
          }

          assert.isFailure = assert.failure;
          suite.cases.push(assert);

          if (assert.isFailure)
            suite.isFailure = true;

        });

        if (suite.isFailure)
          pkg.isFailure = true;

      });

      run.addPackage(pkg);

    });

    done(null, run);
  }
270585
public static synchronized void generate() {
        LOGGER.debug("Generating documentation of test documentation included in pythonlib directories.");
        try {
            IS_RUNNING = true;
            List<File> pythonLibDirectories = findPythonLibDirectories(ROOT_SCRIPT_DIRECTORY);

            List<File> pythonScriptFiles = findPythonScripts(pythonLibDirectories);
            for (File script : pythonScriptFiles) {
                if (hasToGenerateDocumentation(script)) {
                    GenerateTestStepsModulesDoc.generate(script.getAbsolutePath());
                }
            }
            ALREADY_RUN = true;
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            IS_RUNNING = false;
        }
    }
623925
def suite_name
      files.map{ |path| File.dirname(path).sub(Dir.pwd+'/','') }.uniq.join(',')
    end
766311
def run(config, path=None, stop_on_error=True, just_tests=False):
    """"""
    if path is None:
        path = os.getcwd()
    prep(config, path=path)

    models = __import__('models')
    tests = __import__('tests')
    suites = __import__('suites')

    print('\n')
    for x in ['models', 'tests', 'suites']:
        module = __import__(x)
        assert hasattr(module, x), "'%s' module requires attribute '%s'" %\
                                   (x, x)

    if just_tests:
        for test in tests.tests:
            _run(test, models, stop_on_error)

    else:
        for suite in suites.suites:
            _run(suite, models, stop_on_error)
324771
def finish_suite(suite)
      total      = suite.count_tests
      passes     = suite.count_passes
      assertions = suite.count_assertions
      failures   = suite.count_failures
      errors     = suite.count_errors
      skips      = suite.count_skips

      bar = '=' * 78
      # @FIXME: Remove this, since Colorize already take care of colorize?
      if colorize?
        bar = if pass == total then Colorize.green(bar)
              else Colorize.red(bar) end
      end

      # @FIXME: Should we add suite.runtime, instead if this lame time calculations?
      tally = [total, assertions, (Time.new - @time)]

      io.puts bar
      io.puts "  pass: %d,  fail: %d,  error: %d, skip: %d" % [passes, failures, errors, skips]
      io.puts "  total: %d tests with %d assertions in %f seconds" % tally
      io.puts bar
    end
77683
def get_stack_info():
    '''
    '''
    stack = traceback.walk_stack(sys._getframe().f_back)

    # We want locals from the test definition (which always begins
    # with 'test_' in unittest), which will be at a different
    # level in the stack depending on how many tests are in each
    # test case, how many test cases there are, etc.

    # The branch where we exhaust this loop is not covered
    # because we always find a test.
    for frame, _ in stack:  # pragma: no branch
        code = frame.f_code
        if code.co_name.startswith('test_'):
            return (frame.f_locals.copy(), frame.f_globals['__name__'],
                    code.co_filename, frame.f_lineno)
535118
def get_configs(__pkg: str, __name: str = 'config') -> List[str]:
    
    dirs = [user_config(__pkg), ]
    dirs.extend(path.expanduser(path.sep.join([d, __pkg]))
                for d in getenv('XDG_CONFIG_DIRS', '/etc/xdg').split(':'))
    configs = []
    for dname in reversed(dirs):
        test_path = path.join(dname, __name)
        if path.exists(test_path):
            configs.append(test_path)
    return configs
1291985
public Collection<T> getDescriptors(TestClass testClass) {
        final List<T> descriptors = new ArrayList<T>();
        for (Method testMethod : testClass.getMethods(resourceAnnotation)) {
            descriptors.addAll(getDescriptorsDefinedFor(testMethod));
        }
        descriptors.addAll(obtainClassLevelDescriptor(testClass.getAnnotation(resourceAnnotation)));
        return descriptors;
    }
40485
private List<String> getSourceRoots( final MavenProject project, final String scope )
    {
        if ( SCOPE_COMPILE.equals( scope ) || SCOPE_RUNTIME.equals( scope ) )
        {
            return project.getCompileSourceRoots();
        }
        else if ( SCOPE_TEST.equals( scope ) )
        {
            List<String> sourceRoots = new ArrayList<String>();
            sourceRoots.addAll( project.getTestCompileSourceRoots() );
            sourceRoots.addAll( project.getCompileSourceRoots() );
            return sourceRoots;
        }
        else
        {
            throw new RuntimeException( "Not allowed scope " + scope );
        }
    }
846415
def get_stack(method_name):
    
    global test_suite
    trace_string      = method_name + " "
    for f in inspect.stack():
        module_name = os.path.basename(f[1])
        method_name = f[3]
        trace_string = trace_string + "%s %s " % (module_name, method_name)
        if test_suite and module_name == test_suite or (module_name == 'patch.py' and method_name == 'patched_test'):
            return trace_string
    return trace_string
1174617
def visible_suite_paths(cls, paths=None):
        
        suite_paths = []
        if paths is None:
            paths = os.getenv("PATH", "").split(os.pathsep)
        for path in paths:
            if path and os.path.isdir(path):
                path_ = os.path.dirname(path)
                filepath = os.path.join(path_, "suite.yaml")
                if os.path.isfile(filepath):
                    suite_paths.append(path_)
        return suite_paths
1065074
def _tools_classpath_pairs(self, dest_dir):
    """"""
    tools_classpath = self._tools_classpath
    return [(entry, os.path.join(dest_dir, '{}-{}'.format(idx, os.path.basename(entry))))
            for idx, entry in enumerate(tools_classpath)]