Skip to content

Conversation

LaoGunz
Copy link
Collaborator

@LaoGunz LaoGunz commented Aug 11, 2022

add params to py and sh scripts, refactor structure and methods, add …

main.py Outdated
print(result)

x = StringValue(value="hello, world")
adder = TestMessageAdder(appender="!", port=8788)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут раньше еще по дефолту же докер был, надо чтоб и он тестился, чтоб не сломалось например изменениями

process_chmod = subprocess.run(f'chmod +x {self.project_output_path}create_venv.sh', shell=True)
process_run = subprocess.run(f'{self.project_output_path}create_venv.sh', shell=True)

def create_files_for_tests(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот тест он для чего? он точно внутри должен быть, а не где-то в папке tests в корне проекта?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот тест генерится уже для конечного пользователя. Создается он во вновь созданной директории проекта, которая может быть (и чаще всего) отлично от исходной диреткории нашего шаблона. Тест првоеряет корректность созданного и активированного виртуального окружения и запуск функционала из файла main.py

)

@staticmethod
def render_venv_python():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот это хорошая мысль, и нейминг, возможно мы ее как-то расширим для разных уровней вложенности энвов друг в друга

output.write("\n".join(requirements))


class VirtualEnvExecutor:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока так отлично, но на будущее куда-то себе пометить мысль, что это некий микс выходит энва и экзекьютора, то есть может сделать именно енвом эту логику, а экзекьюторы более абстрактными без исполнения и только на тестах выяснять что все ок исполняется

import argparse


def sum_factorial(number: int) -> int:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А это как некий мок?
Может просто в лог выводить "Found no implementation! Fix it, please!"

from piper_new_out.main import sum_factorial


def test_base_func_from_main():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это просто не в темплейт надо, а отнаследоваться от VenvExecutor и добавить в call факториала подсчет, тогда отличный тест как раз выйдет, что все ок на просто примере оборачивается)

@LaoGunz LaoGunz merged commit 11b87bd into main Aug 26, 2022
sokolegg pushed a commit that referenced this pull request Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants