Skip to content

Feature: Pytest In A Subprocess - #1

Merged
JamesVorder merged 9 commits into
mainfrom
feature/pytest-subprocess
Jul 17, 2024
Merged

Feature: Pytest In A Subprocess#1
JamesVorder merged 9 commits into
mainfrom
feature/pytest-subprocess

Conversation

@JamesVorder

@JamesVorder JamesVorder commented Jul 13, 2024

Copy link
Copy Markdown
Owner

The goal of this PR is to improve our test execution methodology in two ways:

  • Making it more general in the sense that our tests can contain more flexible imports
  • Making it more general in the sense that we could theoretically execute different test runners more trivially

As of commit b0fd195, we have a fully working but messy implementation of a Pytest runner utilizing plugins for test output capture and generated module reload. The reason this is messy is because we have to interact directly with the Python import internals to reload the generated module on each iteration (so that it tests the newly generated code.) This implementation choice means our pytests are not allowed to do imports a la from generated.test_class import .... This is a huge bummer, as most people do imports this way. In addition, it is necessary to have an empty generated/test_class.py file sitting around on the first run. That empty file requires management too, which is annoying.

The changes in this PR introduce a GenericTestRunner class, which can be implemented and injected into the chat function trivially. In addition, a "test result interpreter" has been added. This is another LLM invocation, which provides advice about what to change in the code under test. With these two things combined, we have a system that can easily be extended to test different types of code. We also gain the ability to do our imports however we want in the tests. :)

@JamesVorder
JamesVorder marked this pull request as draft July 13, 2024 14:11
@JamesVorder
JamesVorder marked this pull request as ready for review July 17, 2024 02:45
@JamesVorder
JamesVorder merged commit d149230 into main Jul 17, 2024
@JamesVorder
JamesVorder deleted the feature/pytest-subprocess branch July 17, 2024 02:46
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.

1 participant