Example #1
0
    def test_ShouldReturnFalseIfInitIsNotAFile(self, isdir, isfile, exists):
        exists.return_value = True
        isfile.return_value = False
        isdir.return_value = True
        plugin_file = PythonLoader("plugins/my_plugin")

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_false)
Example #2
0
    def test_ShouldReturnFalseIfInitIsNotAFile(self, isdir, isfile, exists):
        exists.return_value = True
        isfile.return_value = False
        isdir.return_value = True
        plugin_file = PythonLoader("plugins/my_plugin")

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_false)
Example #3
0
    def test_ShouldReturnFalseIfInitFileDoesNotExistInDir(
            self, isdir, isfile, exists):
        exists.side_effect = [True, False]
        isfile.side_effect = [False, True]
        isdir.return_value = True
        plugin_file = PythonLoader("plugins/my_plugin")

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_false)
Example #4
0
    def test_ShouldReturnTrueifPluginIsDirAndExists(self, isdir, exists,
                                                    isfile):
        isfile.side_effect = [False, True]
        exists.return_value = True
        isdir.return_value = True
        plugin_module = PythonLoader("plugin/my_plugin")

        expect(plugin_module.is_plugin(fs_tools=os.path)).to(be_true)
Example #5
0
    def test_ShouldReturnFalseIfInitFileDoesNotExistInDir(self, isdir, isfile,
                                                          exists):
        exists.side_effect = [True, False]
        isfile.side_effect = [False, True]
        isdir.return_value = True
        plugin_file = PythonLoader("plugins/my_plugin")

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_false)
Example #6
0
    def test_ShouldReturnTrueifPluginIsDirAndExists(self, isdir, exists,
                                                    isfile):
        isfile.side_effect = [False, True]
        exists.return_value = True
        isdir.return_value = True
        plugin_module = PythonLoader("plugin/my_plugin")

        expect(plugin_module.is_plugin(fs_tools=os.path)).to(be_true)
Example #7
0
    def test_ShouldReturnModuleNameSutableForImport(self):
        plugin_file = PythonLoader("plugin/my_plugin.py")
        plugin_module = PythonLoader("plugin/my_plugin")  # Module dir

        expect(plugin_file.import_name()).to(equal("my_plugin"))
        expect(plugin_module.import_name()).to(equal("my_plugin"))
Example #8
0
    def test_ShouldReturnFalseIfPluginDoesNotExist(self, exists):
        exists.return_value = False
        plugin_file = PythonLoader("plugins/my_plugin.py")

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_false)
Example #9
0
    def test_ShouldReturnTrueIfPluginIsFileAndExists(self, isfile, exists):
        plugin_file = PythonLoader("plugin/my_plugin.py")
        isfile.return_value = True
        exists.return_value = True

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_true)
Example #10
0
    def test_ShouldReturnModuleNameSutableForImport(self):
        plugin_file = PythonLoader("plugin/my_plugin.py")
        plugin_module = PythonLoader("plugin/my_plugin")  # Module dir

        expect(plugin_file.import_name()).to(equal("my_plugin"))
        expect(plugin_module.import_name()).to(equal("my_plugin"))
Example #11
0
    def test_ShouldReturnFalseIfPluginDoesNotExist(self, exists):
        exists.return_value = False
        plugin_file = PythonLoader("plugins/my_plugin.py")

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_false)
Example #12
0
    def test_ShouldReturnTrueIfPluginIsFileAndExists(self, isfile, exists):
        plugin_file = PythonLoader("plugin/my_plugin.py")
        isfile.return_value = True
        exists.return_value = True

        expect(plugin_file.is_plugin(fs_tools=os.path)).to(be_true)