Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for ffmpeg in base images #2122

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build:
gpu: true
python_version: "3.9"
python_packages:
- "torch==2.5.1"
cuda: "12.4"
run:
- command: ffmpeg --help
predict: "predict.py:Predictor"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from cog import BasePredictor


class Predictor(BasePredictor):
def predict(self, s: str) -> str:
return "hello " + s
22 changes: 20 additions & 2 deletions test-integration/test_integration/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,17 @@ def test_pip_freeze(docker_image):
labels = image[0]["Config"]["Labels"]
pip_freeze = labels["run.cog.pip_freeze"]
pip_freeze = "\n".join(
[x for x in pip_freeze.split("\n") if not x.startswith("cog @")]
[
x
for x in pip_freeze.split("\n")
if not x.startswith("cog @")
and not x.startswith("fastapi")
and not x.startswith("starlette")
]
)
assert (
pip_freeze
== "anyio==4.4.0\nattrs==23.2.0\ncertifi==2024.8.30\ncharset-normalizer==3.3.2\nclick==8.1.7\nexceptiongroup==1.2.2\nfastapi==0.115.6\nh11==0.14.0\nhttptools==0.6.1\nidna==3.8\npydantic==1.10.18\npython-dotenv==1.0.1\nPyYAML==6.0.2\nrequests==2.32.3\nsniffio==1.3.1\nstarlette==0.41.3\nstructlog==24.4.0\ntyping_extensions==4.12.2\nurllib3==2.2.2\nuvicorn==0.30.6\nuvloop==0.20.0\nwatchfiles==0.24.0\nwebsockets==13.0.1\n"
== "anyio==4.4.0\nattrs==23.2.0\ncertifi==2024.8.30\ncharset-normalizer==3.3.2\nclick==8.1.7\nexceptiongroup==1.2.2\nh11==0.14.0\nhttptools==0.6.1\nidna==3.8\npydantic==1.10.18\npython-dotenv==1.0.1\nPyYAML==6.0.2\nrequests==2.32.3\nsniffio==1.3.1\nstructlog==24.4.0\ntyping_extensions==4.12.2\nurllib3==2.2.2\nuvicorn==0.30.6\nuvloop==0.20.0\nwatchfiles==0.24.0\nwebsockets==13.0.1\n"
)


Expand Down Expand Up @@ -434,3 +440,15 @@ def test_pydantic2(docker_image):
)

assert build_process.returncode == 0


def test_ffmpeg_base_image(docker_image):
project_dir = Path(__file__).parent / "fixtures/ffmpeg-package"

build_process = subprocess.run(
["cog", "build", "-t", docker_image],
cwd=project_dir,
capture_output=True,
)

assert build_process.returncode == 0
Loading