예제 #1
0
    def test_main(self):
        from luiti import TaskWeek, ArrowParameter

        class HelloWorldWeek(TaskWeek):
            root_dir = "/foobar"

        # Tuesday
        task1 = HelloWorldWeek("2014-09-02")
        # Monday
        self.assertEqual(task1.date_value, ArrowParameter.get("2014-09-01"))

        self.assertEqual(task1.data_dir, "/foobar/2014-09-01")
        self.assertEqual(task1.data_file,
                         "/foobar/2014-09-01/hello_world_week.json")
        self.assertEqual(task1.date_str, "2014-09-01")
        self.assertEqual(task1.date_type, "week")
        self.assertEqual(task1.date_value_by_type_in_last,
                         ArrowParameter.get("2014-08-25"))
        self.assertEqual(task1.task_class, HelloWorldWeek)
예제 #2
0
    def test_main(self):
        from luiti import TaskWeek, ArrowParameter

        class HelloWorldWeek(TaskWeek):
            root_dir = "/foobar"

        # Tuesday
        task1 = HelloWorldWeek("2014-09-02")
        # Monday
        self.assertEqual(task1.date_value, ArrowParameter.get("2014-09-01"))

        self.assertEqual(task1.data_dir, "/foobar/2014-09-01")
        self.assertEqual(
            task1.data_file, "/foobar/2014-09-01/hello_world_week.json")
        self.assertEqual(task1.date_str, "2014-09-01")
        self.assertEqual(task1.date_type, "week")
        self.assertEqual(
            task1.date_value_by_type_in_last, ArrowParameter.get("2014-08-25"))
        self.assertEqual(task1.task_class, HelloWorldWeek)
예제 #3
0
import os
import sys
RootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, RootDir)
os.environ['LUIGI_CONFIG_PATH'] = RootDir + '/tests/client.cfg'

import unittest

from luiti.tests import date_begin
from luiti.tests import SetupLuitiPackages
luiti_config = SetupLuitiPackages.config  # make a ref

# 3. setup tests variables
from luiti import manager, ArrowParameter
day_str = "2014-09-01T00:00:00+08:00"  # ISO 8601 format
day_arrow = ArrowParameter.get(day_str)  # Fix maybe tested in other time zone.


class TestLuitiExt(unittest.TestCase):
    def test_as_a_luiti_task(self):
        from luigi.contrib.hive import HiveQueryTask
        from luiti import luigi, TaskBase

        @luigi.as_a_luiti_task()
        class SomeHive(HiveQueryTask):
            pass

        self.assertTrue(issubclass(SomeHive, TaskBase))
        self.assertTrue(issubclass(SomeHive, luigi.Task))

        class AnotherHiveDay(SomeHive):
예제 #4
0
import os
import sys
RootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, RootDir)
os.environ['LUIGI_CONFIG_PATH'] = RootDir + '/tests/client.cfg'

import unittest

from luiti.tests import date_begin
from luiti.tests import SetupLuitiPackages
luiti_config = SetupLuitiPackages.config  # make a ref

# 3. setup tests variables
from luiti import manager, ArrowParameter
day_str = "2014-09-01T00:00:00+08:00"  # ISO 8601 format
day_arrow = ArrowParameter.get(day_str)  # Fix maybe tested in other time zone.


class TestLuitiExt(unittest.TestCase):

    def test_as_a_luiti_task(self):
        from luigi.contrib.hive import HiveQueryTask
        from luiti import luigi, TaskBase

        @luigi.as_a_luiti_task()
        class SomeHive(HiveQueryTask):
            pass

        self.assertTrue(issubclass(SomeHive, TaskBase))
        self.assertTrue(issubclass(SomeHive, luigi.Task))