Skip to content
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
14 changes: 3 additions & 11 deletions processor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@ class Config:
def __init__(self):
self.ENVIRONMENT = os.getenv("ENVIRONMENT", "local")

if self.ENVIRONMENT == "local":
self.INPUT_DIR = os.getenv("INPUT_DIR")
self.OUTPUT_DIR = os.getenv("OUTPUT_DIR")
else:
# workflow / analysis pipeline only supports 3 processors (pre-, main, post-)
# the output directory of the main processor is what the post-processor needs to read from
# so for now we will set the input directory for this processor to be the output directory variable
self.INPUT_DIR = os.getenv("OUTPUT_DIR")
self.OUTPUT_DIR = os.path.join(self.INPUT_DIR, "output")
if not os.path.exists(self.OUTPUT_DIR):
os.makedirs(self.OUTPUT_DIR)
self.INPUT_DIR = os.getenv("INPUT_DIR")
self.OUTPUT_DIR = os.getenv("OUTPUT_DIR")


self.CHUNK_SIZE_MB = int(os.getenv("CHUNK_SIZE_MB", "1"))

Expand Down
52 changes: 0 additions & 52 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,41 +156,6 @@ def test_local_importer_enabled_override(self, tmp_path):
class TestConfigProductionEnvironment:
"""Tests for Config class in production environment."""

def test_production_environment_directories(self, tmp_path):
"""Test Config in production environment uses OUTPUT_DIR for input."""
output_dir = tmp_path / "output"
output_dir.mkdir()

env_vars = {
"ENVIRONMENT": "production",
"OUTPUT_DIR": str(output_dir),
}

with patch.dict(os.environ, env_vars, clear=True):
config = Config()

# In production, INPUT_DIR is set to OUTPUT_DIR
assert config.INPUT_DIR == str(output_dir)
# And OUTPUT_DIR is a subdirectory
assert config.OUTPUT_DIR == str(output_dir / "output")

def test_production_creates_output_subdirectory(self, tmp_path):
"""Test that production config creates output subdirectory."""
base_dir = tmp_path / "base"
base_dir.mkdir()

env_vars = {
"ENVIRONMENT": "production",
"OUTPUT_DIR": str(base_dir),
}

with patch.dict(os.environ, env_vars, clear=True):
config = Config()

expected_output = base_dir / "output"
assert os.path.exists(expected_output)
assert config.OUTPUT_DIR == str(expected_output)

def test_production_importer_enabled_by_default(self, tmp_path):
"""Test IMPORTER_ENABLED defaults to True in production."""
base_dir = tmp_path / "base"
Expand Down Expand Up @@ -280,23 +245,6 @@ def test_missing_api_credentials(self, tmp_path):
assert config.API_KEY is None
assert config.API_SECRET is None

def test_non_standard_environment(self, tmp_path):
"""Test Config with non-standard environment name."""
base_dir = tmp_path / "base"
base_dir.mkdir()

env_vars = {
"ENVIRONMENT": "staging",
"OUTPUT_DIR": str(base_dir),
}

with patch.dict(os.environ, env_vars, clear=True):
config = Config()

# Non-local environments should use production logic
assert config.ENVIRONMENT == "staging"
assert config.INPUT_DIR == str(base_dir)

def test_chunk_size_conversion_to_int(self, tmp_path):
"""Test that CHUNK_SIZE_MB is converted to integer."""
env_vars = {
Expand Down