def test_luigi_run_exception(self): sys.argv = [ "luigi", "Top10ArtistsRunException", "--Top10ArtistsRunException-date-interval", "2020-05-02", "--local-scheduler", "--module", str("tests.luigi_examples.top_artists"), ] with mock.patch("dbnd_luigi.luigi_tracking.handler") as handler: status_code = dbnd_luigi_run() assert handler.on_failure.call_count == 1 assert handler.on_success.call_count == 2 assert handler.on_dependency_discovered.call_count == 2 assert handler.on_run_start.call_count == 3 assert status_code == 1
def test_luigi_run_exception(self): sys.argv = [ "luigi", "Top10ArtistsRunException", "--Top10ArtistsRunException-date-interval", "2020-05-02", "--local-scheduler", "--module", str("tests.luigi_examples.top_artists"), ] with dbnd_config({CoreConfig.tracker: ["file", "console"]}): with mock.patch("dbnd_luigi.luigi_tracking.handler") as handler: result = dbnd_luigi_run() assert handler.on_failure.call_count == 1 assert handler.on_success.call_count == 2 assert handler.on_dependency_discovered.call_count == 2 assert handler.on_run_start.call_count == 3 assert result.status == LuigiStatusCode.FAILED
from dbnd_luigi.luigi_tracking import dbnd_luigi_run if __name__ == "__main__": dbnd_luigi_run()