Skip to content

Commit

Permalink
rust: Add test for bootstrapped rust install with C.DEFAULT
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Oct 4, 2022
1 parent da5ca6f commit cef3842
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/languages/rust_test.py
Expand Up @@ -33,7 +33,8 @@ def test_uses_default_when_rust_is_not_available(cmd_output_b_mck):
assert ACTUAL_GET_DEFAULT_VERSION() == C.DEFAULT


def test_installs_with_bootstrapped_rustup(tmpdir):
@pytest.mark.parametrize('language_version', (C.DEFAULT, '1.56.0'))
def test_installs_with_bootstrapped_rustup(tmpdir, language_version):
tmpdir.join('src', 'main.rs').ensure().write(
'fn main() {'
' println!("Hello, world!");'
Expand Down Expand Up @@ -68,13 +69,13 @@ def mocked_find_executable(exe: str) -> str | None:

with mock.patch.object(parse_shebang, 'find_executable') as find_exe_mck:
find_exe_mck.side_effect = mocked_find_executable
rust.install_environment(prefix, '1.64.0', ())
rust.install_environment(prefix, language_version, ())
assert find_executable_exes == ['rustup', 'rustup', 'cargo']

# this directory shouldn't exist, make sure we succeed without it existing
shutil.rmtree(tmpdir.join('target'))

with rust.in_env(prefix, '1.64.0'):
with rust.in_env(prefix, language_version):
assert cmd_output('hello_world')[1] == 'Hello, world!\n'


Expand Down

0 comments on commit cef3842

Please sign in to comment.