Skip to content

Commit

Permalink
fix -it flags
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Loftus committed Nov 28, 2024
1 parent 99c3fe5 commit 0c9596a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Python Script in Docker
name: E2E Dagster build

on:
push:
Expand All @@ -18,5 +18,5 @@ jobs:
uses: docker/setup-buildx-action@v2

# Run the Python script that handles the build and execution
- name: Run Python Script
- name: Launch Docker Stack and run tests
run: python3 main.py local && python3 main.py test
10 changes: 7 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def up(local: bool, debug: bool):
print("Missing .env file. Do you want to copy .env.example to .env ? (y/n)")
# check if you are running in a terminal or in CI/CD
if not sys.stdin.isatty():
print("y")
shutil.copy(".env.example", ".env")
else:
answer = input().lower()
Expand Down Expand Up @@ -110,8 +109,13 @@ def test():
)
if not containerName:
raise RuntimeError("Could not find the user code container to run pytest")
containerName = containerName.strip()
run_subprocess(f"docker exec -it {containerName} pytest")
containerName = containerName.strip() # Container name sometimes has extra \n

# If we are in CI/CD we need to skip the interactive / terminal flags
if sys.stdin.isatty():
run_subprocess(f"docker exec {containerName} pytest")
else:
run_subprocess(f"docker exec -it {containerName} pytest")


def main():
Expand Down

0 comments on commit 0c9596a

Please sign in to comment.