-
Notifications
You must be signed in to change notification settings - Fork 14
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
Showing
7 changed files
with
172 additions
and
6 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,29 @@ | ||
name: Build and test | ||
on: | ||
push: | ||
branches: [ 'main' ] | ||
|
||
pull_request: | ||
branches: [ 'main' ] | ||
|
||
# This allows a subsequently queued workflow run to interrupt and cancel previous runs | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Run-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python: [ '3.8', '3.9', '3.10', '3.11' ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: '${{ matrix.python }}' | ||
architecture: 'x64' | ||
- run: pip install -U pip wheel poetry | ||
- run: poetry install --with dev | ||
- run: poetry run pytest tests |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,58 @@ | ||
import tempfile | ||
|
||
import pytest | ||
from typer.testing import CliRunner | ||
|
||
from airflowctl.cli import app | ||
|
||
runner = CliRunner() | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def temp_project_dir(): | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
yield temp_dir | ||
|
||
|
||
def test_init_command(temp_project_dir): | ||
result = runner.invoke( | ||
app, | ||
[ | ||
"init", | ||
temp_project_dir, | ||
"--project-name", | ||
"my_project", | ||
"--airflow-version", | ||
"2.6.3", | ||
"--build-start", | ||
"--background", | ||
], | ||
) | ||
|
||
assert result.exit_code == 0, result.output | ||
assert "Airflow project built successfully." in result.output | ||
|
||
|
||
def test_build_command(temp_project_dir): | ||
result = runner.invoke( | ||
app, | ||
[ | ||
"init", | ||
temp_project_dir, | ||
"--project-name", | ||
"my_project", | ||
], | ||
) | ||
|
||
assert result.exit_code == 0, result.output | ||
result_1 = runner.invoke( | ||
app, | ||
[ | ||
"build", | ||
temp_project_dir, | ||
# "--recreate-venv" | ||
], | ||
) | ||
|
||
assert result_1.exit_code == 0, result_1.output | ||
assert "Airflow project built successfully." in result_1.output |