예제 #1
0
 def __init__(self):
     self.file_path = PyFunceble.CONFIGURATION["file_to_test"]
     self.current_time = int(strftime("%s"))
     self.day_in_seconds = PyFunceble.CONFIGURATION[
         "days_between_db_retest"] * 24 * 3600
     self.inactive_db_path = PyFunceble.CURRENT_DIRECTORY + PyFunceble.OUTPUTS[
         "default_files"]["inactive_db"]
예제 #2
0
    def _travis(self):
        """
        Logic behind travis autosave.
        """

        try:
            _ = PyFunceble.environ["TRAVIS_BUILD_DIR"]
            current_time = int(strftime("%s"))
            time_autorisation = False

            try:
                time_autorisation = current_time >= int(
                    PyFunceble.CONFIGURATION["start"]) + (int(
                        PyFunceble.CONFIGURATION["travis_autosave_minutes"]) *
                                                          60)
            except KeyError:
                if self.last and not self.bypass:
                    raise Exception(
                        "Please review the way `ExecutionTime()` is called.")

            if self.last or time_autorisation or self.bypass:
                Percentage().log()
                self.travis_permissions()

                command = 'git add --all && git commit -a -m "%s"'

                if self.last or self.bypass:
                    if PyFunceble.CONFIGURATION["command_before_end"]:
                        print(
                            Command(
                                PyFunceble.CONFIGURATION["command_before_end"]
                            ).execute())

                        self.travis_permissions()

                    message = PyFunceble.CONFIGURATION[
                        "travis_autosave_final_commit"] + " [ci skip]"

                    Command(command % message).execute()
                else:
                    Command(command %
                            PyFunceble.CONFIGURATION["travis_autosave_commit"]
                            ).execute()

                Command("git push origin %s" %
                        PyFunceble.CONFIGURATION["travis_branch"]).execute()
                exit(0)
        except KeyError:
            pass
예제 #3
0
    def _stoping_time(cls):  # pragma: no cover
        """
        Set the ending time.
        """

        PyFunceble.CONFIGURATION["end"] = int(strftime("%s"))
예제 #4
0
    def _starting_time(cls):  # pragma: no cover
        """
        Set the starting time.
        """

        PyFunceble.CONFIGURATION["start"] = int(strftime("%s"))