Skip to content

Commit 25b5798

Browse files
committed
Fix working directory and unlink compiled example before test.
1 parent d646890 commit 25b5798

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

cmdstanpy/install_cmdstan.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,13 @@ def compile_example(verbose: bool = False) -> None:
349349
350350
:param verbose: Boolean value; when ``True``, show output from make command.
351351
"""
352-
cmd = [
353-
MAKE,
354-
Path(
355-
os.path.join('examples', 'bernoulli', 'bernoulli' + EXTENSION)
356-
).as_posix(),
357-
]
352+
path = Path(
353+
os.path.join('examples', 'bernoulli', 'bernoulli' + EXTENSION)
354+
)
355+
if path.is_file():
356+
path.unlink()
357+
358+
cmd = [MAKE, path.as_posix()]
358359
try:
359360
if verbose:
360361
do_command(cmd)
@@ -635,8 +636,10 @@ def run_install(args: Union[InteractiveSettings, InstallationSettings]) -> None:
635636
)
636637
else:
637638
print('CmdStan version {} already installed'.format(args.version))
638-
print('Test model compilation')
639-
compile_example(args.verbose)
639+
640+
with pushd(cmdstan_version):
641+
print('Test model compilation')
642+
compile_example(args.verbose)
640643

641644

642645
def parse_cmdline_args() -> Dict[str, Any]:

0 commit comments

Comments
 (0)