def test_find_best_app(test_apps): """Test if `find_best_app` behaves as expected with different combinations of input.""" class Module: app = Flask('appname') assert find_best_app(Module) == Module.app class Module: application = Flask('appname') assert find_best_app(Module) == Module.application class Module: myapp = Flask('appname') assert find_best_app(Module) == Module.myapp class Module: pass pytest.raises(NoAppException, find_best_app, Module) class Module: myapp1 = Flask('appname1') myapp2 = Flask('appname2') pytest.raises(NoAppException, find_best_app, Module)
def test_find_best_app(): script_info = ScriptInfo() class Module: @staticmethod def create_app(foo): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: @staticmethod def create_app(foo=None, script_info=None): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname'
def test_find_best_app(test_apps): """Test of find_best_app.""" class mod: app = Flask('appname') assert find_best_app(mod) == mod.app class mod: application = Flask('appname') assert find_best_app(mod) == mod.application class mod: myapp = Flask('appname') assert find_best_app(mod) == mod.myapp class mod: myapp = Flask('appname') myapp2 = Flask('appname2') pytest.raises(NoAppException, find_best_app, mod)
def test_find_best_app(test_apps): """Test if `find_best_app` behaves as expected with different combinations of input.""" class Module: app = Flask('appname') class Module: application = Flask('appname') class Module: myapp = Flask('appname') assert find_best_app(Module) == Module.app class Module: pass
def test_find_best_app(test_apps): """Test if `find_best_app` behaves as expected with different combinations of input.""" script_info = ScriptInfo() class Module: app = Flask('appname') assert find_best_app(script_info, Module) == Module.app class Module: application = Flask('appname') assert find_best_app(script_info, Module) == Module.application class Module: myapp = Flask('appname') assert find_best_app(script_info, Module) == Module.myapp class Module: @staticmethod def create_app(): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: @staticmethod def create_app(foo): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: @staticmethod def create_app(foo=None, script_info=None): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: @staticmethod def make_app(): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: myapp = Flask('appname1') @staticmethod def create_app(): return Flask('appname2') assert find_best_app(script_info, Module) == Module.myapp class Module: myapp = Flask('appname1') @staticmethod def create_app(): return Flask('appname2') assert find_best_app(script_info, Module) == Module.myapp class Module: pass pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: myapp1 = Flask('appname1') myapp2 = Flask('appname2') pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: @staticmethod def create_app(foo, bar): return Flask('appname2') pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: @staticmethod def create_app(): raise TypeError('bad bad factory!') pytest.raises(TypeError, find_best_app, script_info, Module)
def test_find_best_app(test_apps): script_info = ScriptInfo() class Module: app = Flask("appname") assert find_best_app(script_info, Module) == Module.app class Module: application = Flask("appname") assert find_best_app(script_info, Module) == Module.application class Module: myapp = Flask("appname") assert find_best_app(script_info, Module) == Module.myapp class Module: @staticmethod def create_app(): return Flask("appname") app = find_best_app(script_info, Module) assert isinstance(app, Flask) assert app.name == "appname" class Module: @staticmethod def create_app(foo): return Flask("appname") with pytest.deprecated_call(match="Script info"): app = find_best_app(script_info, Module) assert isinstance(app, Flask) assert app.name == "appname" class Module: @staticmethod def create_app(foo=None, script_info=None): return Flask("appname") with pytest.deprecated_call(match="script_info"): app = find_best_app(script_info, Module) assert isinstance(app, Flask) assert app.name == "appname" class Module: @staticmethod def make_app(): return Flask("appname") app = find_best_app(script_info, Module) assert isinstance(app, Flask) assert app.name == "appname" class Module: myapp = Flask("appname1") @staticmethod def create_app(): return Flask("appname2") assert find_best_app(script_info, Module) == Module.myapp class Module: myapp = Flask("appname1") @staticmethod def create_app(): return Flask("appname2") assert find_best_app(script_info, Module) == Module.myapp class Module: pass pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: myapp1 = Flask("appname1") myapp2 = Flask("appname2") pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: @staticmethod def create_app(foo, bar): return Flask("appname2") pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: @staticmethod def create_app(): raise TypeError("bad bad factory!") pytest.raises(TypeError, find_best_app, script_info, Module)
def test_find_best_app(test_apps): class Module: app = Flask("appname") assert find_best_app(Module) == Module.app class Module: application = Flask("appname") assert find_best_app(Module) == Module.application class Module: myapp = Flask("appname") assert find_best_app(Module) == Module.myapp class Module: @staticmethod def create_app(): return Flask("appname") app = find_best_app(Module) assert isinstance(app, Flask) assert app.name == "appname" class Module: @staticmethod def create_app(**kwargs): return Flask("appname") app = find_best_app(Module) assert isinstance(app, Flask) assert app.name == "appname" class Module: @staticmethod def make_app(): return Flask("appname") app = find_best_app(Module) assert isinstance(app, Flask) assert app.name == "appname" class Module: myapp = Flask("appname1") @staticmethod def create_app(): return Flask("appname2") assert find_best_app(Module) == Module.myapp class Module: myapp = Flask("appname1") @staticmethod def create_app(): return Flask("appname2") assert find_best_app(Module) == Module.myapp class Module: pass pytest.raises(NoAppException, find_best_app, Module) class Module: myapp1 = Flask("appname1") myapp2 = Flask("appname2") pytest.raises(NoAppException, find_best_app, Module) class Module: @staticmethod def create_app(foo, bar): return Flask("appname2") pytest.raises(NoAppException, find_best_app, Module) class Module: @staticmethod def create_app(): raise TypeError("bad bad factory!") pytest.raises(TypeError, find_best_app, Module)
def test_find_best_app(test_apps): """Test if `find_best_app` behaves as expected with different combinations of input.""" script_info = ScriptInfo() class Module: app = Flask('appname') assert find_best_app(script_info, Module) == Module.app class Module: application = Flask('appname') assert find_best_app(script_info, Module) == Module.application class Module: myapp = Flask('appname') assert find_best_app(script_info, Module) == Module.myapp class Module: @staticmethod def create_app(): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: @staticmethod def create_app(foo): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: @staticmethod def create_app(foo=None, script_info=None): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: @staticmethod def make_app(): return Flask('appname') assert isinstance(find_best_app(script_info, Module), Flask) assert find_best_app(script_info, Module).name == 'appname' class Module: myapp = Flask('appname1') @staticmethod def create_app(): return Flask('appname2') assert find_best_app(script_info, Module) == Module.myapp class Module: myapp = Flask('appname1') @staticmethod def create_app(): return Flask('appname2') assert find_best_app(script_info, Module) == Module.myapp class Module: pass pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: myapp1 = Flask('appname1') myapp2 = Flask('appname2') pytest.raises(NoAppException, find_best_app, script_info, Module) class Module: @staticmethod def create_app(foo, bar): return Flask('appname2') pytest.raises(NoAppException, find_best_app, script_info, Module)
class Module: myapp = Flask('appname') assert find_best_app(Module) == Module.app class Module: pass <<<<<<< REMOTE class Module: myapp1 = Flask('appname1') myapp2 = Flask('appname2') ======= >>>>>>> LOCAL pytest.raises(NoAppException, find_best_app, Module) assert find_best_app(Module) == Module.application assert find_best_app(Module) == Module.myapp pytest.raises(NoAppException, find_best_app, Module) def test_prepare_exec_for_file(test_apps): """Expect the correct path to be set and the correct module name to be returned. :func:`prepare_exec_for_file` has a side effect, where the parent directory of given file is added to `sys.path`. """ realpath = os.path.realpath('/tmp/share/test.py') dirname = os.path.dirname(realpath) assert prepare_exec_for_file('/tmp/share/test.py') == 'test' assert dirname in sys.path
def test_find_best_app(test_apps): """Test if `find_best_app` behaves as expected with different combinations of input.""" class Module: app = Flask('appname') assert find_best_app(Module) == Module.app class Module: application = Flask('appname') assert find_best_app(Module) == Module.application class Module: myapp = Flask('appname') assert find_best_app(Module) == Module.myapp class Module: @staticmethod def create_app(): return Flask('appname') assert isinstance(find_best_app(Module), Flask) assert find_best_app(Module).name == 'appname' class Module: @staticmethod def make_app(): return Flask('appname') assert isinstance(find_best_app(Module), Flask) assert find_best_app(Module).name == 'appname' class Module: myapp = Flask('appname1') @staticmethod def create_app(): return Flask('appname2') assert find_best_app(Module) == Module.myapp class Module: myapp = Flask('appname1') @staticmethod def create_app(foo): return Flask('appname2') assert find_best_app(Module) == Module.myapp class Module: pass pytest.raises(NoAppException, find_best_app, Module) class Module: myapp1 = Flask('appname1') myapp2 = Flask('appname2') pytest.raises(NoAppException, find_best_app, Module) class Module: @staticmethod def create_app(foo): return Flask('appname2') pytest.raises(NoAppException, find_best_app, Module)