-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8ad3b5
commit dac1347
Showing
5 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Integration Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: "4.4" | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements_test.txt | ||
- name: Run integration test | ||
run: | | ||
phulpy integration_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import contextlib | ||
import io | ||
import os | ||
import re | ||
|
||
def extract_python_snippets(content): | ||
# Regular expression pattern for finding Python code blocks | ||
pattern = r'```python(.*?)```' | ||
snippets = re.findall(pattern, content, re.DOTALL) | ||
|
||
return snippets | ||
|
||
def evaluate_snippet(snippet): | ||
# Capture the output of the snippet | ||
output_buffer = io.StringIO() | ||
with contextlib.redirect_stdout(output_buffer): | ||
exec(snippet, globals()) | ||
return output_buffer.getvalue() | ||
|
||
|
||
class TestReadme: | ||
def test_readme(self): | ||
readme_path = os.path.join(os.path.dirname(__file__), "..", "README.md") | ||
readme_contents = open(readme_path, "r").read().strip() | ||
snippets = extract_python_snippets(readme_contents) | ||
for snippet in snippets: | ||
evaluate_snippet(snippet) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters