Exemplo n.º 1
0
Arquivo: xp.py Projeto: zbxzc35/PLearn
    def __init__(self, targets, options):
        super(running, self).__init__(targets, options)
        assert not targets

        r = 0
        for exp in ls():
            if exp.startswith("expdir") and \
               not os.path.exists( os.path.join(exp, ExperimentResults.metainfos_path) ):
                if r == 0:
                    print
                r += 1
                print exp

        print("\n(%d experiment%s %s running)" %
              (r, toolkit.plural(r), toolkit.plural(r, 'is', 'are')))
Exemplo n.º 2
0
    def checkForExpectedTests(self):
        """Assert that all tests provided through --test-name were found."""
        missing_expected_tests = Test.missingExpectedTests()
        if not missing_expected_tests:
            return

        # Some tests were not found!
        msg_pair = (toolkit.plural(len(missing_expected_tests)),
                    ','.join(missing_expected_tests))
        logging.warning('\nSome test%s (%s) were not found!!!' % msg_pair)
        if hasattr(self.options, 'all') and self.options.all:
            raise PyTestUsageError(
                "Asked for test%s named %s which can't be found." % msg_pair)

        # Try to "fast-locate" missing tests
        logging.warning('Trying to "fast-locate" missing tests...')
        cached_test_map = core.getCachedTestMap()
        while missing_expected_tests:
            test_name = missing_expected_tests.pop()
            if test_name in cached_test_map:
                target = cached_test_map[test_name]
                self.build_tests((self.options, []), target,
                                 os.listdir(target))

            # If you can't fast locate, use brute force
            else:
                logging.warning(
                    'Must use brute force since %s was not in cache...' %
                    test_name)
                self.options.all = True
                Test._instances_map = {}  # To avoid DuplicateName errors
                for target in plbranches:
                    os.path.walk(target, self.build_tests, (self.options, []))
                # Can't enter an infinite loop since we now have 'self.options.all == True'
                return self.checkForExpectedTests()
Exemplo n.º 3
0
    def checkForExpectedTests(self):
        """Assert that all tests provided through --test-name were found."""
        missing_expected_tests = Test.missingExpectedTests()
        if not missing_expected_tests:
            return

        # Some tests were not found!
        msg_pair = (toolkit.plural(len(missing_expected_tests)),
                    ','.join(missing_expected_tests))
        logging.warning('\nSome test%s (%s) were not found!!!'%msg_pair)
        if hasattr(self.options, 'all') and self.options.all:
            raise PyTestUsageError(
                "Asked for test%s named %s which can't be found." % msg_pair)
            
        # Try to "fast-locate" missing tests
        logging.warning('Trying to "fast-locate" missing tests...')
        cached_test_map = core.getCachedTestMap()
        while missing_expected_tests:
            test_name = missing_expected_tests.pop()
            if test_name in cached_test_map:
                target = cached_test_map[test_name]
                self.build_tests( (self.options, []), target, os.listdir(target) )

            # If you can't fast locate, use brute force
            else:
                logging.warning('Must use brute force since %s was not in cache...'%test_name)
                self.options.all = True
                Test._instances_map = {} # To avoid DuplicateName errors
                for target in plbranches:
                    os.path.walk( target, self.build_tests, (self.options, []) )
                # Can't enter an infinite loop since we now have 'self.options.all == True'
                return self.checkForExpectedTests()
Exemplo n.º 4
0
Arquivo: xp.py Projeto: deccs/PLearn
    def __init__( self, targets, options ):
        super(running, self).__init__(targets, options)
        assert not targets
        
        r = 0
        for exp in ls():
            if exp.startswith("expdir") and \
               not os.path.exists( os.path.join(exp, ExperimentResults.metainfos_path) ):
                if r == 0:
                    print
                r += 1
                print exp

        print( "\n(%d experiment%s %s running)"
               % ( r, toolkit.plural(r),
                   toolkit.plural(r, 'is', 'are') )
               )