Skip to content

Commit

Permalink
Reduce hardcoded strings, fix windows test
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <[email protected]>
  • Loading branch information
luca-della-vedova committed Jun 24, 2024
1 parent 9a34d93 commit f344aff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/rust-sample-package/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "rust-sample-app"
name = "rust-sample-package"
version = "0.1.0"
authors = ["Nikos Koukis <[email protected]>"]
edition = "2018"
Expand Down
13 changes: 10 additions & 3 deletions test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Apache License, Version 2.0

import asyncio
import os
from pathlib import Path
import shutil
import tempfile
Expand All @@ -15,7 +16,9 @@
from colcon_core.task import TaskContext
import pytest

test_project_path = Path(__file__).parent / 'rust-sample-package'
TEST_PACKAGE_NAME = 'rust-sample-package'

test_project_path = Path(__file__).parent / TEST_PACKAGE_NAME


@pytest.fixture(autouse=True)
Expand All @@ -33,7 +36,7 @@ def test_package_identification():
desc = PackageDescriptor(test_project_path)
cpi.identify(desc)
assert desc.type == 'cargo'
assert desc.name == 'rust-sample-app'
assert desc.name == TEST_PACKAGE_NAME


@pytest.mark.skipif(
Expand Down Expand Up @@ -75,6 +78,10 @@ def test_build_package():

# Make sure the binary is compiled
install_base = Path(task.context.args.install_base)
assert (install_base / 'bin' / 'rust-sample-app').is_file()
app_name = TEST_PACKAGE_NAME
# Executable in windows have a .exe extension
if os.name == 'nt':
app_name += '.exe'
assert (install_base / 'bin' / app_name).is_file()
finally:
event_loop.close()

0 comments on commit f344aff

Please sign in to comment.