Exemplo n.º 1
0
    def test_replaces_old_module_objects_with_new_ones_during_create_module(self):
        paths = ["module.py", P("sub/dir/module.py"), P("other/module.py")]
        project = ProjectWithModules(paths)

        new_module = project.create_module(P("other/module.py"))

        assert_length(project.get_modules(), 3)
        assert project[P("other/module.py")] is new_module
Exemplo n.º 2
0
    def test_replaces_old_module_objects_with_new_ones_during_create_module(
            self):
        paths = ["module.py", P("sub/dir/module.py"), P("other/module.py")]
        project = ProjectWithModules(paths)

        new_module = project.create_module(P("other/module.py"))

        assert_length(project.get_modules(), 3)
        assert project[P("other/module.py")] is new_module
Exemplo n.º 3
0
    def test_replaces_module_instance_in_test_cases_associated_modules_during_module_replacement(self):
        paths = ["module.py", P("sub/dir/module.py"), P("other/module.py")]
        project = ProjectWithModules(paths)
        test_class = create(TestClass, name='TestAnything', associated_modules=[project[P("other/module.py")]])
        add_test_case(project[P("other/module.py")], test_class)

        new_module = project.create_module(P("other/module.py"))

        assert_length(test_class.associated_modules, 1)
        assert test_class.associated_modules[0] is new_module
Exemplo n.º 4
0
    def test_replaces_module_instance_in_test_cases_associated_modules_during_module_replacement(
            self):
        paths = ["module.py", P("sub/dir/module.py"), P("other/module.py")]
        project = ProjectWithModules(paths)
        test_class = create(TestClass,
                            name='TestAnything',
                            associated_modules=[project[P("other/module.py")]])
        add_test_case(project[P("other/module.py")], test_class)

        new_module = project.create_module(P("other/module.py"))

        assert_length(test_class.associated_modules, 1)
        assert test_class.associated_modules[0] is new_module