# Path: distgen/distro_version.py
# def detect_default_distro():
#     """
#     Based on the current information from python-distro module, return the
#     expected default distgen config.  Return None if distro can not be detected.
#     """
# 
#     distro, version, name = distro_module.linux_distribution(full_distribution_name=True)
# 
#     if distro == 'Fedora Linux':
#         distro = 'Fedora'
# 
#     distro = distro.lower()
# 
#     if distro == 'fedora':
#         if name.lower() == 'rawhide':
#             version = 'rawhide'
#     elif distro in ['centos', 'rhel']:
#         pass
#     else:
#         return None
# 
#     # Only RPM distros for now:
#     cmd = ['rpm', '--eval', '%_arch']
#     arch = subprocess.check_output(cmd).decode('ascii').strip()
# 
#     return '{0}-{1}-{2}.yaml'.format(distro, version, arch)


import pytest
    from unittest.mock import patch
    from mock import patch
from distgen.distro_version import detect_default_distro

try:
except ImportError:



class TestDistroDetection(object):
    @pytest.mark.parametrize('arch', [b'x86_64', b'i386'])
    @pytest.mark.parametrize('distro, version, name, cversion', [
        ('fedora', 24, 'sth',            24),
        ('fedora', 25, 'sth',            25),
        ('fedora', 21, 'rawhide', 'rawhide'),
        ('rhel',    7, 'sth',             7),
    ])
    @patch('subprocess.check_output')
    @patch('distro.linux_distribution')
    def test_rpm(self, pdist, sp_co, distro, version, name, cversion, arch):
        sp_co.return_value = arch
        pdist.return_value = (distro, version, name)


# Path: distgen/distro_version.py
# def detect_default_distro():
#     """
#     Based on the current information from python-distro module, return the
#     expected default distgen config.  Return None if distro can not be detected.
#     """
# 
#     distro, version, name = distro_module.linux_distribution(full_distribution_name=True)
# 
#     if distro == 'Fedora Linux':
#         distro = 'Fedora'
# 
#     distro = distro.lower()
# 
#     if distro == 'fedora':
#         if name.lower() == 'rawhide':
#             version = 'rawhide'
#     elif distro in ['centos', 'rhel']:
#         pass
#     else:
#         return None
# 
#     # Only RPM distros for now:
#     cmd = ['rpm', '--eval', '%_arch']
#     arch = subprocess.check_output(cmd).decode('ascii').strip()
# 
#     return '{0}-{1}-{2}.yaml'.format(distro, version, arch)


# Path: tests/unittests/test_distro_detection.py
import pytest
    from unittest.mock import patch
    from mock import patch
from distgen.distro_version import detect_default_distro


try:
except ImportError:



class TestDistroDetection(object):
    @pytest.mark.parametrize('arch', [b'x86_64', b'i386'])
    @pytest.mark.parametrize('distro, version, name, cversion', [
        ('fedora', 24, 'sth',            24),
        ('fedora', 25, 'sth',            25),
        ('fedora', 21, 'rawhide', 'rawhide'),
        ('rhel',    7, 'sth',             7),
    ])
    @patch('subprocess.check_output')
    @patch('distro.linux_distribution')
    def test_rpm(self, pdist, sp_co, distro, version, name, cversion, arch):
        sp_co.return_value = arch
        pdist.return_value = (distro, version, name)


        assert detect_default_distro() == '{0}-{1}-{2}.yaml'.format(