@@ -742,6 +742,71 @@ def test_parse_requirements(tmpdir):
742742 ]
743743
744744
745+ def test_prepare_build_context_conda_no_env_file (tmp_path_factory ):
746+ """Conda provider without an environment file does not error at staging."""
747+ src_dir = tmp_path_factory .mktemp ("src" )
748+ (src_dir / "tesseract_api.py" ).touch ()
749+ build_dir = tmp_path_factory .mktemp ("build" )
750+
751+ config = TesseractConfig (
752+ name = "foobar" ,
753+ build_config = TesseractBuildConfig (requirements = {"provider" : "conda" }),
754+ )
755+ engine .prepare_build_context (src_dir , build_dir , config )
756+ assert (build_dir / "Dockerfile" ).exists ()
757+
758+
759+ @pytest .mark .parametrize (
760+ "line, expected" ,
761+ [
762+ ("./mylocaldep" , ("./mylocaldep" , "" )),
763+ ("./mylocaldep[extra]" , ("./mylocaldep" , "[extra]" )),
764+ ("../../pkg[a,b]" , ("../../pkg" , "[a,b]" )),
765+ ("/abs/path" , ("/abs/path" , "" )),
766+ ("./a[b] " , ("./a" , "[b]" )),
767+ ],
768+ )
769+ def test_split_local_dependency (line , expected ):
770+ assert engine ._split_local_dependency (line ) == expected
771+
772+
773+ def test_stage_local_dependency_file (tmp_path ):
774+ """A local file dependency (e.g. a wheel) is copied, not tree-copied."""
775+ src_dir = tmp_path / "src"
776+ src_dir .mkdir ()
777+ (src_dir / "mypkg-1.0-py3-none-any.whl" ).write_text ("wheel contents" )
778+ local_requirements = tmp_path / "local_requirements"
779+ local_requirements .mkdir ()
780+
781+ spec = engine ._stage_local_dependency (
782+ "./mypkg-1.0-py3-none-any.whl" , "" , src_dir , local_requirements
783+ )
784+ staged = local_requirements / "mypkg-1.0-py3-none-any.whl"
785+ assert spec == "./local_requirements/mypkg-1.0-py3-none-any.whl"
786+ assert staged .is_file ()
787+ assert staged .read_text () == "wheel contents"
788+
789+
790+ def test_stage_local_dependency_name_collision (tmp_path ):
791+ """Two dependencies resolving to the same basename get distinct staged names."""
792+ src_dir = tmp_path / "src"
793+ (src_dir / "a" / "mypkg" ).mkdir (parents = True )
794+ (src_dir / "b" / "mypkg" ).mkdir (parents = True )
795+ local_requirements = tmp_path / "local_requirements"
796+ local_requirements .mkdir ()
797+
798+ spec_a = engine ._stage_local_dependency (
799+ "./a/mypkg" , "" , src_dir , local_requirements
800+ )
801+ spec_b = engine ._stage_local_dependency (
802+ "./b/mypkg" , "" , src_dir , local_requirements
803+ )
804+ assert spec_a == "./local_requirements/mypkg"
805+ assert spec_b == "./local_requirements/mypkg_1"
806+ assert (local_requirements / "mypkg" ).is_dir ()
807+ assert (local_requirements / "mypkg_1" ).is_dir ()
808+
809+
745810@pytest .mark .parametrize (
746811 "spec, expected" ,
747812 [
0 commit comments