import json
import stat
import subprocess

import pytest
import sys
import os
import os.path


@pytest.fixture
def artifact_path():
    dist_dir = os.path.join(os.path.dirname(__file__), 'dist')
    if not os.path.isdir(dist_dir):
        raise ValueError(f"dist directory \"{dist_dir}\" does not exist")
    dist_files = [dir_entry.path for dir_entry in os.scandir(dist_dir) if dir_entry.is_file()]
    if len(dist_files) > 1:
        raise ValueError(f"Find multiple artifacts in the \"{dist_dir}\" directory")
    elif len(dist_files) == 0:
        raise ValueError(f"No artifacts are found in the \"{dist_dir}\" directory")
    artifact_path = dist_files[0]
    artifact_mode = os.stat(artifact_path).st_mode
    if not artifact_mode & stat.S_IEXEC:
        os.chmod(artifact_path, artifact_mode | stat.S_IEXEC)
    return artifact_path


def test_show_devices(artifact_path):
    result = subprocess.run([artifact_path, 'show-devices', '--format', 'json'],
                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    result.check_returncode()
    output = json.loads(result.stdout)
    assert isinstance(output, list)


if __name__ == '__main__':
    # check minimal python version
    assert sys.version_info >= (3, 6)
    sys.exit(pytest.main(args=[__file__]))

c4e8ef342086deb9b3518ba8dd314cafe7a3e384
<mask token>


@pytest.fixture
def artifact_path():
    dist_dir = os.path.join(os.path.dirname(__file__), 'dist')
    if not os.path.isdir(dist_dir):
        raise ValueError(f'dist directory "{dist_dir}" does not exist')
    dist_files = [dir_entry.path for dir_entry in os.scandir(dist_dir) if
        dir_entry.is_file()]
    if len(dist_files) > 1:
        raise ValueError(
            f'Find multiple artifacts in the "{dist_dir}" directory')
    elif len(dist_files) == 0:
        raise ValueError(
            f'No artifacts are found in the "{dist_dir}" directory')
    artifact_path = dist_files[0]
    artifact_mode = os.stat(artifact_path).st_mode
    if not artifact_mode & stat.S_IEXEC:
        os.chmod(artifact_path, artifact_mode | stat.S_IEXEC)
    return artifact_path


<mask token>

<mask token>


@pytest.fixture
def artifact_path():
    dist_dir = os.path.join(os.path.dirname(__file__), 'dist')
    if not os.path.isdir(dist_dir):
        raise ValueError(f'dist directory "{dist_dir}" does not exist')
    dist_files = [dir_entry.path for dir_entry in os.scandir(dist_dir) if
        dir_entry.is_file()]
    if len(dist_files) > 1:
        raise ValueError(
            f'Find multiple artifacts in the "{dist_dir}" directory')
    elif len(dist_files) == 0:
        raise ValueError(
            f'No artifacts are found in the "{dist_dir}" directory')
    artifact_path = dist_files[0]
    artifact_mode = os.stat(artifact_path).st_mode
    if not artifact_mode & stat.S_IEXEC:
        os.chmod(artifact_path, artifact_mode | stat.S_IEXEC)
    return artifact_path


def test_show_devices(artifact_path):
    result = subprocess.run([artifact_path, 'show-devices', '--format',
        'json'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    result.check_returncode()
    output = json.loads(result.stdout)
    assert isinstance(output, list)


<mask token>

<mask token>


@pytest.fixture
def artifact_path():
    dist_dir = os.path.join(os.path.dirname(__file__), 'dist')
    if not os.path.isdir(dist_dir):
        raise ValueError(f'dist directory "{dist_dir}" does not exist')
    dist_files = [dir_entry.path for dir_entry in os.scandir(dist_dir) if
        dir_entry.is_file()]
    if len(dist_files) > 1:
        raise ValueError(
            f'Find multiple artifacts in the "{dist_dir}" directory')
    elif len(dist_files) == 0:
        raise ValueError(
            f'No artifacts are found in the "{dist_dir}" directory')
    artifact_path = dist_files[0]
    artifact_mode = os.stat(artifact_path).st_mode
    if not artifact_mode & stat.S_IEXEC:
        os.chmod(artifact_path, artifact_mode | stat.S_IEXEC)
    return artifact_path


def test_show_devices(artifact_path):
    result = subprocess.run([artifact_path, 'show-devices', '--format',
        'json'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    result.check_returncode()
    output = json.loads(result.stdout)
    assert isinstance(output, list)


if __name__ == '__main__':
    assert sys.version_info >= (3, 6)
    sys.exit(pytest.main(args=[__file__]))

import json
import stat
import subprocess
import pytest
import sys
import os
import os.path


@pytest.fixture
def artifact_path():
    dist_dir = os.path.join(os.path.dirname(__file__), 'dist')
    if not os.path.isdir(dist_dir):
        raise ValueError(f'dist directory "{dist_dir}" does not exist')
    dist_files = [dir_entry.path for dir_entry in os.scandir(dist_dir) if
        dir_entry.is_file()]
    if len(dist_files) > 1:
        raise ValueError(
            f'Find multiple artifacts in the "{dist_dir}" directory')
    elif len(dist_files) == 0:
        raise ValueError(
            f'No artifacts are found in the "{dist_dir}" directory')
    artifact_path = dist_files[0]
    artifact_mode = os.stat(artifact_path).st_mode
    if not artifact_mode & stat.S_IEXEC:
        os.chmod(artifact_path, artifact_mode | stat.S_IEXEC)
    return artifact_path


def test_show_devices(artifact_path):
    result = subprocess.run([artifact_path, 'show-devices', '--format',
        'json'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    result.check_returncode()
    output = json.loads(result.stdout)
    assert isinstance(output, list)


if __name__ == '__main__':
    assert sys.version_info >= (3, 6)
    sys.exit(pytest.main(args=[__file__]))

import json
import stat
import subprocess

import pytest
import sys
import os
import os.path


@pytest.fixture
def artifact_path():
    dist_dir = os.path.join(os.path.dirname(__file__), 'dist')
    if not os.path.isdir(dist_dir):
        raise ValueError(f"dist directory \"{dist_dir}\" does not exist")
    dist_files = [dir_entry.path for dir_entry in os.scandir(dist_dir) if dir_entry.is_file()]
    if len(dist_files) > 1:
        raise ValueError(f"Find multiple artifacts in the \"{dist_dir}\" directory")
    elif len(dist_files) == 0:
        raise ValueError(f"No artifacts are found in the \"{dist_dir}\" directory")
    artifact_path = dist_files[0]
    artifact_mode = os.stat(artifact_path).st_mode
    if not artifact_mode & stat.S_IEXEC:
        os.chmod(artifact_path, artifact_mode | stat.S_IEXEC)
    return artifact_path


def test_show_devices(artifact_path):
    result = subprocess.run([artifact_path, 'show-devices', '--format', 'json'],
                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    result.check_returncode()
    output = json.loads(result.stdout)
    assert isinstance(output, list)


if __name__ == '__main__':
    # check minimal python version
    assert sys.version_info >= (3, 6)
    sys.exit(pytest.main(args=[__file__]))
