Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions conf/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ CONF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

build_docs=0
build_docker=0
offline=0

. "${CONF_DIR}/env.sh"

Expand All @@ -32,6 +33,9 @@ while [[ $# -ne 0 ]]; do
docker)
build_docker=1
;;
offline)
offline=1
;;
*)
;;
esac
Expand All @@ -41,9 +45,18 @@ done
echo "======= FORMATTING CODE ========="
ruff format
echo "======= BUILDING PACKAGE ========="
rm -rf "${ROOT_DIR}/build/lib/sonar" "${ROOT_DIR}/build/lib/cli" "${ROOT_DIR}"/build/scripts*/sonar-tools "${ROOT_DIR}"/dist/sonar_tools*
# python -m build
poetry build
if [[ "${offline}" = "1" ]]; then
cp "${ROOT_DIR}/conf/offline/setup.py" "${ROOT_DIR}/"
cp "${ROOT_DIR}/conf/offline/sonar-tools" "${ROOT_DIR}/"
mv "${ROOT_DIR}/pyproject.toml" "${ROOT_DIR}/pyproject.toml.bak"
python setup.py bdist_wheel
mv "${ROOT_DIR}/pyproject.toml.bak" "${ROOT_DIR}/pyproject.toml"
rm "${ROOT_DIR}/setup.py" "${ROOT_DIR}/sonar-tools" "${ROOT_DIR}/sonar_tools.egg-info"
# python -m build
else
rm -rf "${ROOT_DIR}/build/lib/sonar" "${ROOT_DIR}/build/lib/cli" "${ROOT_DIR}"/build/scripts*/sonar-tools "${ROOT_DIR}"/dist/sonar_tools*
poetry build
fi

if [[ "${build_docs}" = "1" ]]; then
echo "======= BUILDING DOCS ========="
Expand Down
4 changes: 2 additions & 2 deletions test/unit/credentials-latest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
TARGET_TOKEN = getenv("SONAR_TOKEN_LATEST_ADMIN_USER")

ISSUE_FP = "64e848c0-d5f4-402e-8c80-af6536041b5e"
ISSUE_FP_NBR_CHANGELOGS = 13
ISSUE_FP_CHANGELOG_DATE = datetime(2025, 10, 23)
ISSUE_FP_NBR_CHANGELOGS = 15
ISSUE_FP_CHANGELOG_DATE = datetime(2025, 11, 2)

ISSUE_ACCEPTED = "e9eb08fe-bb53-443a-8a92-425589807c78"
4 changes: 2 additions & 2 deletions test/unit/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
TARGET_TOKEN = getenv("SONAR_TOKEN_LATEST_ADMIN_USER")

ISSUE_FP = "64e848c0-d5f4-402e-8c80-af6536041b5e"
ISSUE_FP_NBR_CHANGELOGS = 13
ISSUE_FP_CHANGELOG_DATE = datetime(2025, 10, 23)
ISSUE_FP_NBR_CHANGELOGS = 15
ISSUE_FP_CHANGELOG_DATE = datetime(2025, 11, 2)

ISSUE_ACCEPTED = "e9eb08fe-bb53-443a-8a92-425589807c78"
18 changes: 3 additions & 15 deletions test/unit/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def test_import_no_zip(get_test_project: Generator[projects.Project]) -> None:
pytest.skip("No zip import in Community Build")
assert get_test_project.import_zip(asynchronous=False) == "FAILED/ZIP_MISSING"
get_test_project.key = "non-existing"
res = get_test_project.import_zip(asynchronous=False)
assert res.startswith("FAILED/ZIP_MISSING")
with pytest.raises(exceptions.ObjectNotFound):
get_test_project.import_zip(asynchronous=False)


def test_monorepo() -> None:
Expand Down Expand Up @@ -365,19 +365,6 @@ def test_audit_languages(get_test_project: Generator[projects.Project]) -> None:
assert proj.audit_languages({"audit.projects.utilityLocs": True}) == []


def test_wrong_key_2(get_test_project: Generator[projects.Project]) -> None:
"""test_wrong_key"""
proj = get_test_project
proj.key = tutil.NON_EXISTING_KEY
with pytest.raises(exceptions.ObjectNotFound):
_ = proj.webhooks()
with pytest.raises(exceptions.ObjectNotFound):
_ = proj.links()
# assert proj.quality_gate() is None
with pytest.raises(exceptions.ObjectNotFound):
proj.audit({})


def test_set_permissions(get_test_project: Generator[projects.Project]) -> None:
"""test_set_permissions"""
proj = get_test_project
Expand Down Expand Up @@ -405,6 +392,7 @@ def test_import_zips() -> None:
res = projects.import_zips(tutil.SQ, project_list=proj_list)
assert len(res) == len(proj_list)
assert sum(1 for r in res.values() if r["importStatus"] != "SUCCESS") == len(proj_list)
projects.Project.get_object(tutil.SQ, "non-existing").delete()


def test_export_zips() -> None:
Expand Down
File renamed without changes.