Skip to content
Open
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
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
# Read requirements.txt, ignore comments
try:
with open("requirements.txt", "r") as f:
REQUIRES = [line.split('#', 1)[0].strip() for line in f if line.strip()]
except:
print("'requirements.txt' not found!")
REQUIRES = list()
REQUIRES = [line.split("#", 1)[0].strip() for line in f if line.strip()]
except FileNotFoundError:
raise FileNotFoundError("requirements.txt not found!")

setup(
name="FinGPT",
Expand Down
20 changes: 20 additions & 0 deletions tests/test_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
import pytest

def test_requirements_exists():
assert os.path.exists("requirements.txt")

def test_requirements_not_empty():
with open("requirements.txt", "r") as f:
lines = [line.strip() for line in f if line.strip()]
assert len(lines) > 0

def test_requirements_commented_lines():
with open("requirements.txt", "r") as f:
for line in f:
assert "#" in line or line.strip() != ""

def test_setup_runs():
import subprocess
result = subprocess.run(["python", "setup.py", "--name"], capture_output=True, text=True)
assert "FinGPT" in result.stdout