Skip to content

Commit

Permalink
fix: update project run test to use proper project generation
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent c4e3b1f commit ba32b21
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions tests/test_project_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from agentstack.conf import ConfigFile
from agentstack import frameworks
from agentstack.cli import run_project
from agentstack.generation import project_generation

BASE_PATH = Path(__file__).parent

Expand All @@ -17,28 +18,20 @@ class ProjectRunTest(unittest.TestCase):
def setUp(self):
self.project_dir = BASE_PATH / 'tmp/project_run' / self.framework

os.makedirs(self.project_dir)
os.makedirs(self.project_dir / 'src')
(self.project_dir / 'src' / '__init__.py').touch()

with open(self.project_dir / 'src' / 'main.py', 'w') as f:
f.write('def run(): pass')
# Generate project using the proper template
project_generation.generate_project(
project_dir=self.project_dir,
framework=self.framework,
project_name="Test Project",
project_slug="test-project"
)

# set the framework in agentstack.json
shutil.copy(BASE_PATH / 'fixtures' / 'agentstack.json', self.project_dir / 'agentstack.json')
conf.set_path(self.project_dir)
with ConfigFile() as config:
config.framework = self.framework

# populate the entrypoint
entrypoint_path = frameworks.get_entrypoint_path(self.framework)
print(f"Copying from {BASE_PATH}/fixtures/frameworks/{self.framework}/entrypoint_max.py to {entrypoint_path}")
print(f"Entrypoint path exists before copy: {entrypoint_path.exists()}")
print(f"Source path exists: {(BASE_PATH / f'fixtures/frameworks/{self.framework}/entrypoint_max.py').exists()}")
shutil.copy(BASE_PATH / f"fixtures/frameworks/{self.framework}/entrypoint_max.py", entrypoint_path)
print(f"Entrypoint path exists after copy: {entrypoint_path.exists()}")
if entrypoint_path.exists():
print(f"Entrypoint content:\n{entrypoint_path.read_text()}")
# write a basic .env file
shutil.copy(BASE_PATH / 'fixtures' / '.env', self.project_dir / '.env')

Expand Down

0 comments on commit ba32b21

Please sign in to comment.