Exemple #1
0
    def test___getitem___filesystem_filtered( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'filters'
                                           )
                             )

        zuite._updateProperty( 'filename_glob'
                             , 'test_*.html'
                             )

        try:
            excluded = zuite[ 'exclude_me.html' ]
        except KeyError:
            pass
        else:
            self.fail( "Didn't exclude 'exclude_me.html'." )

        for name in ( 'test_one.html'
                    , 'test_another.html'
                    ):
            object = zuite[ name ]
            self.assertEqual( object.meta_type, 'File' )
Exemple #2
0
    def test___getitem___filesystem_filtered( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'filters'
                                           )
                             )

        zuite._updateProperty( 'filename_glob'
                             , 'test_*.html'
                             )

        try:
            excluded = zuite[ 'exclude_me.html' ]
        except KeyError:
            pass
        else:
            self.fail( "Didn't exclude 'exclude_me.html'." )

        for name in ( 'test_one.html'
                    , 'test_another.html'
                    ):
            object = zuite[ name ]
            self.assertEqual( object.meta_type, 'File' )
Exemple #3
0
    def test_listTestCases_filesystem(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'flat'))

        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 1)
        self.assertEqual(cases[0]['id'], 'test_simple.html')
Exemple #4
0
    def test___getitem___filesystem(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'flat'))

        for name in ('test_simple.html', ):
            object = zuite[name]
            self.assertEqual(object.meta_type, 'File')
Exemple #5
0
    def test_listTestCases_filesystem_recursive(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'nested'))

        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 2)
        case_ids = [x['id'] for x in cases]
        self.assertTrue('test_one.html' in case_ids)
        self.assertTrue('test_another.html' in case_ids)
Exemple #6
0
    def test___getitem___filesystem_recursive(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'nested'))

        for subdir, name in (('one', 'test_one.html'), ('two',
                                                        'test_another.html')):
            proxy = zuite[subdir]
            object = proxy[name]
            self.assertEqual(object.meta_type, 'File')
Exemple #7
0
    def test_listTestCases_filesystem( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'flat'
                                           )
                             )

        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 1 )
        self.assertEqual( cases[ 0 ][ 'id' ], 'test_simple.html' )
Exemple #8
0
    def test_listTestCases_filesystem_ordered_explicit(self):

        # Use the ordering specified in '.objects'.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty(
            'filesystem_path',
            os.path.join(package_home(globals()), 'ordered', 'explicit'))
        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 2)
        case_ids = [x['id'] for x in cases]
        self.assertEqual(case_ids[0], 'test_beta.html')
        self.assertEqual(case_ids[1], 'test_alpha.html')
Exemple #9
0
    def test_listTestCases_filesystem_ordered_default(self):

        # By default, sort alphabetically.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty(
            'filesystem_path',
            os.path.join(package_home(globals()), 'ordered', 'default'))
        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 2)
        case_ids = [x['id'] for x in cases]
        self.assertEqual(case_ids[0], 'test_alpha.html')
        self.assertEqual(case_ids[1], 'test_beta.html')
Exemple #10
0
    def test_listTestCases_filesystem_recursive_explicit(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'fussy'))
        cases = zuite.listTestCases()
        case_ids = [x['id'] for x in cases]
        self.assertEqual(len(case_ids), 5, case_ids)
        self.assertEqual(case_ids[0], 'test_niece1.html')
        self.assertEqual(case_ids[1], 'test_niece2.html')
        self.assertEqual(case_ids[2], 'test_uncle.html')
        self.assertEqual(case_ids[3], 'test_nephew2.html')
        self.assertEqual(case_ids[4], 'test_nephew1.html')
Exemple #11
0
    def test_listTestCases_filesystem_recursive( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'nested'
                                           )
                             )

        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 2 )
        case_ids = [ x[ 'id' ] for x in cases ]
        self.failUnless( 'test_one.html' in case_ids )
        self.failUnless( 'test_another.html' in case_ids )
Exemple #12
0
    def test___getitem___filesystem( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'flat'
                                           )
                             )

        for name in ( 'test_simple.html'
                    ,
                    ):
            object = zuite[ name ]
            self.assertEqual( object.meta_type, 'File' )
Exemple #13
0
    def test_listTestCases_filesystem_ordered_explicit( self ):

        # Use the ordering specified in '.objects'.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'ordered'
                                           , 'explicit'
                                           )
                             )
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 2 )
        case_ids = [ x[ 'id' ] for x in cases ]
        self.assertEqual( case_ids[ 0 ], 'test_beta.html' )
        self.assertEqual( case_ids[ 1 ], 'test_alpha.html' )
Exemple #14
0
    def test_listTestCases_filesystem_ordered_default( self ):

        # By default, sort alphabetically.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'ordered'
                                           , 'default'
                                           )
                             )
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 2 )
        case_ids = [ x[ 'id' ] for x in cases ]
        self.assertEqual( case_ids[ 0 ], 'test_alpha.html' )
        self.assertEqual( case_ids[ 1 ], 'test_beta.html' )
Exemple #15
0
    def test___getitem___filesystem_recursive( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'nested'
                                           )
                             )

        for subdir, name in ( ( 'one', 'test_one.html' )
                            , ( 'two', 'test_another.html' )
                            ):
            proxy = zuite[ subdir ]
            object = proxy[ name ]
            self.assertEqual( object.meta_type, 'File' )
Exemple #16
0
    def test_listTestCases_filesystem_recursive_explicit( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'fussy'
                                           )
                             )
        cases = zuite.listTestCases()
        case_ids = [ x[ 'id' ] for x in cases ]
        self.assertEqual( len( case_ids ), 5, case_ids )
        self.assertEqual( case_ids[ 0 ], 'test_niece1.html' )
        self.assertEqual( case_ids[ 1 ], 'test_niece2.html' )
        self.assertEqual( case_ids[ 2 ], 'test_uncle.html' )
        self.assertEqual( case_ids[ 3 ], 'test_nephew2.html' )
        self.assertEqual( case_ids[ 4 ], 'test_nephew1.html' )