|
6 | 6 | from pathlib import Path |
7 | 7 | from unittest.mock import patch |
8 | 8 |
|
9 | | -import pytest |
10 | | - |
11 | 9 | from cocoindex_code.config import Config, _detect_device |
12 | 10 |
|
13 | 11 |
|
@@ -83,63 +81,6 @@ def test_default_model_is_minilm(self, tmp_path: Path) -> None: |
83 | 81 | assert "all-MiniLM-L6-v2" in config.embedding_model |
84 | 82 |
|
85 | 83 |
|
86 | | -class TestConfigBatchSize: |
87 | | - """Tests for COCOINDEX_CODE_BATCH_SIZE env var.""" |
88 | | - |
89 | | - def test_default_batch_size_is_16(self, tmp_path: Path) -> None: |
90 | | - with patch.dict( |
91 | | - os.environ, |
92 | | - {"COCOINDEX_CODE_ROOT_PATH": str(tmp_path)}, |
93 | | - ): |
94 | | - os.environ.pop("COCOINDEX_CODE_BATCH_SIZE", None) |
95 | | - config = Config.from_env() |
96 | | - assert config.batch_size == 16 |
97 | | - |
98 | | - def test_batch_size_reads_env_var(self, tmp_path: Path) -> None: |
99 | | - with patch.dict( |
100 | | - os.environ, |
101 | | - { |
102 | | - "COCOINDEX_CODE_ROOT_PATH": str(tmp_path), |
103 | | - "COCOINDEX_CODE_BATCH_SIZE": "32", |
104 | | - }, |
105 | | - ): |
106 | | - config = Config.from_env() |
107 | | - assert config.batch_size == 32 |
108 | | - |
109 | | - def test_batch_size_raises_on_non_integer(self, tmp_path: Path) -> None: |
110 | | - with patch.dict( |
111 | | - os.environ, |
112 | | - { |
113 | | - "COCOINDEX_CODE_ROOT_PATH": str(tmp_path), |
114 | | - "COCOINDEX_CODE_BATCH_SIZE": "notanint", |
115 | | - }, |
116 | | - ): |
117 | | - with pytest.raises(ValueError, match="COCOINDEX_CODE_BATCH_SIZE"): |
118 | | - Config.from_env() |
119 | | - |
120 | | - def test_batch_size_raises_on_zero(self, tmp_path: Path) -> None: |
121 | | - with patch.dict( |
122 | | - os.environ, |
123 | | - { |
124 | | - "COCOINDEX_CODE_ROOT_PATH": str(tmp_path), |
125 | | - "COCOINDEX_CODE_BATCH_SIZE": "0", |
126 | | - }, |
127 | | - ): |
128 | | - with pytest.raises(ValueError, match="COCOINDEX_CODE_BATCH_SIZE"): |
129 | | - Config.from_env() |
130 | | - |
131 | | - def test_batch_size_raises_on_negative(self, tmp_path: Path) -> None: |
132 | | - with patch.dict( |
133 | | - os.environ, |
134 | | - { |
135 | | - "COCOINDEX_CODE_ROOT_PATH": str(tmp_path), |
136 | | - "COCOINDEX_CODE_BATCH_SIZE": "-1", |
137 | | - }, |
138 | | - ): |
139 | | - with pytest.raises(ValueError, match="COCOINDEX_CODE_BATCH_SIZE"): |
140 | | - Config.from_env() |
141 | | - |
142 | | - |
143 | 84 | class TestExtraExtensions: |
144 | 85 | """Tests for COCOINDEX_CODE_EXTRA_EXTENSIONS env var.""" |
145 | 86 |
|
|
0 commit comments