Skip to content

Commit 96e695b

Browse files
committed
Force load_dotenv to use cwd, and move to before the checks
1 parent 8f285e3 commit 96e695b

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
@@ -64,6 +64,7 @@ def build_cli_parser(self, parser):
6464

6565
def run_cli(self, args):
6666
if args.action == "submit" and not args.dry_run:
67+
dotenv.load_dotenv(dotenv_path=dotenv.find_dotenv(usecwd=True))
6768
if self.project_name is None:
6869
raise ChipFlowError(
6970
"Key `chipflow.project_id` is not defined in chipflow.toml; "
@@ -88,7 +89,6 @@ def prepare(self):
8889
def submit(self, rtlil_path, *, dry_run=False):
8990
"""Submit the design to the ChipFlow cloud builder.
9091
"""
91-
dotenv.load_dotenv()
9292
git_head = subprocess.check_output(
9393
["git", "-C", os.environ["CHIPFLOW_ROOT"],
9494
"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)