File: test_python_sdk_tools.py

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (24 lines) | stat: -rw-r--r-- 1,059 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from subprocess import CalledProcessError
import tempfile

import pytest


@pytest.mark.skip(reason="test for SDK team that should be manually activated")
def test_build_package_from_pr_number(github_token):
    from pathlib import Path
    from packaging_tools.drop_tools import build_package_from_pr_number

    # Should build package azure-mgmt-advisor 1.0.1
    with tempfile.TemporaryDirectory() as temp_dir:
        build_package_from_pr_number(github_token, "Azure/azure-sdk-for-python", 2417, temp_dir)
        temp_dir_path = Path(temp_dir)
        files = set(file.relative_to(temp_dir) for file in temp_dir_path.iterdir())
        assert files == {
            Path("azure_mgmt_iothubprovisioningservices-0.2.0-py2.py3-none-any.whl"),
            Path("azure-mgmt-iothubprovisioningservices-0.2.0.zip"),
        }

    # This PR is broken and can't be built: 2040
    with tempfile.TemporaryDirectory() as temp_dir, pytest.raises(CalledProcessError):
        build_package_from_pr_number(github_token, "Azure/azure-sdk-for-python", 2040, temp_dir)