Beispiel #1
0
    def start(self):
        self.path = utils.get_project_path()
        self.create_folder(settings.DIST_FOLDER)
        self.create_folder(settings.ARTILLERY_FOLDER, os.path.join(self.path, settings.DIST_FOLDER))

        self.copy_folders()
        self.copy_files()
Beispiel #2
0
    def inp_file_load(self):
        _file = os.path.join(utils.get_project_path(), settings.INPUT_FOLDER,
                             self.spec_file)

        with open(_file) as open_api_file:
            ret_stream = self.CONVERTER[self.converter](open_api_file)

        return ret_stream
Beispiel #3
0
    def get_project_folder(sub_folder: str = None) -> str:
        """
        Get the base path of folder from where files should be read and/or written to
        :param sub_folder: Sub folder path which should be added to base path
        """

        project_path = utils.get_project_path()

        if sub_folder:
            project_path = os.path.join(project_path, sub_folder)

        return project_path
Beispiel #4
0
    def write_to_file(self, file_name=None, sub_path=None):
        """
        Write to OUT_FILE the generated configuration.
        If generating data for more than one file, over-ride this method as necessary
        """
        file_name = file_name or self.OUT_FILE
        _path = os.path.join(utils.get_project_path(), settings.OUTPUT_FOLDER)

        if sub_path:
            _path = os.path.join(_path, sub_path)

        _file = os.path.join(_path, file_name)

        with open(_file, 'w') as write_file:
            write_file.write(self.convert() + "\n")  # Append EOF New line
Beispiel #5
0
 def test_get_project_path(self, patched_os):
     patched_os.getcwd.return_value = "path"
     assert utils.get_project_path() == "path"
Beispiel #6
0
 def __init__(self):
     self.profiles = []
     self.path = utils.get_project_path()