Beispiel #1
0
    def test_data_roots(self):
        """
            Tests our data roots in various ways.
        """

        data_root = taas.data_root()

        self.assertNotEqual(taas.data_root(), None)

        self.assertEqual(taas.sheets_root(), os.path.join(data_root, "sheets"))
        self.assertEqual(taas.json_root(), os.path.join(data_root, "json"))
Beispiel #2
0
def test_data_roots():
    """
        Tests our data roots in various ways.
    """

    data_root = taas.data_root()

    assert taas.data_root() is not None

    assert taas.sheets_root() == os.path.join(data_root, "sheets")
    assert taas.json_root() == os.path.join(data_root, "json")
Beispiel #3
0
def push_to_github(label):
    """Pushes all our changes to github."""

    # Make sure we're in the right place to do all the git things.
    os.chdir(taas.data_root())

    # If there's nothing to do, then do nothing.
    if (not something_to_commit()):
        print("Nothing to commit.")
        return

    branch_name = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")

    branch_name += "-" + label

    run(["git", "checkout", "-b", branch_name])

    run(["git", "add", "-A"])

    run(["git", "status"])

    run(["git", "commit", "-m", "Automated update: " + label])

    run(["git", "push", "--set-upstream", "origin", branch_name])

    # NB: `hub` is available from github
    run(["hub", "pull-request", "-m", "Automated update: " + label])
Beispiel #4
0
    def test_taas_data_env(self):
        """
            Tests that we handle the TAAS_DATA environment correctly.
        """

        # Clear env first, just in case
        self.clear_env()

        fake_env = "/tmp/somefakedir"

        data = taas.data_root()
        self.assertNotEqual(data, None)

        os.environ["TAAS_DATA"] = fake_env
        data_env = taas.data_root()

        self.assertNotEqual(data_env, data)
        self.assertEqual(data_env, fake_env)
Beispiel #5
0
def test_taas_data_env():
    """
        Tests that we handle the TAAS_DATA environment correctly.
    """

    # Clear env first, just in case
    clear_env()

    fake_env = "/tmp/somefakedir"

    data = taas.data_root()
    assert data is not None

    os.environ["TAAS_DATA"] = fake_env
    data_env = taas.data_root()

    assert data_env != data
    assert data_env == fake_env
Beispiel #6
0
def main():

    label = None

    # Make sure we have a label passed in to tag this commit with.
    # In the future, this is probably going to be the target to update.

    if "TAAS_PR_LABEL" in os.environ:
        label = os.environ["TAAS_PR_LABEL"]
    else:
        try:
            label = sys.argv[1]
        except IndexError:
            sys.exit("Usage {} label".format(sys.argv[0]))

    # In the future we might take an argument to only process one,
    # but we're doing them all for now.
    taas.process_all_sources()

    # Make sure we're in the right plac to do all the git things.
    os.chdir(taas.data_root())

    # If there's nothing to do, then do nothing.
    if (not something_to_commit()):
        print("Nothing to commit.")
        return

    branch_name = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")

    branch_name += "-" + label

    run(["git", "checkout", "-b", branch_name])

    run(["git", "add", "-A"])

    run(["git", "status"])

    run(["git", "commit", "-m", "Automated update: " + label])

    run(["git", "push", "--set-upstream", "origin", branch_name])

    # NB: `hub` is available from github
    run(["hub", "pull-request", "-m", "Automated update: " + label])