Skip to content

Commit c39b2d3

Browse files
committed
Force load_dotenv to use cwd, and move to before the checks
1 parent 206f487 commit c39b2d3

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

chipflow_lib/steps/silicon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def build_cli_parser(self, parser):
6565

6666
def run_cli(self, args):
6767
if args.action == "submit" and not args.dry_run:
68+
dotenv.load_dotenv(dotenv_path=dotenv.find_dotenv(usecwd=True))
6869
if self.project_name is None:
6970
raise ChipFlowError(
7071
"Key `chipflow.project_id` is not defined in chipflow.toml; "
@@ -89,7 +90,6 @@ def prepare(self):
8990
def submit(self, rtlil_path, *, dry_run=False):
9091
"""Submit the design to the ChipFlow cloud builder.
9192
"""
92-
dotenv.load_dotenv()
9393
git_head = subprocess.check_output(
9494
["git", "-C", os.environ["CHIPFLOW_ROOT"],
9595
"rev-parse", "HEAD"],

tests/test_silicon_step.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ def setUp(self):
4141
os.environ["CHIPFLOW_API_KEY_ID"] = "keyid"
4242
os.environ["CHIPFLOW_API_KEY_SECRET"] = "keysecret"
4343

44-
@patch('dotenv.load_dotenv')
4544
@patch('requests.post', side_effect=mocked_requests_post)
46-
def test_submit_happy_path(self, mock_requests_post, mock_dotenv):
45+
def test_submit_happy_path(self, mock_requests_post):
4746
customer_config = f"{current_dir}/fixtures/mock.toml"
4847
with open(customer_config, "rb") as f:
4948
config_dict = tomli.load(f)
@@ -87,5 +86,3 @@ def test_submit_happy_path(self, mock_requests_post, mock_dotenv):
8786
}
8887
}
8988
assert rtlil == b"fake-rtlil", "The RTL file was passed through."
90-
91-
assert mock_dotenv.called

0 commit comments

Comments
 (0)