<gh_stars>0
#!/usr/bin/env python2

import os
import errno
import sys
import subprocess
import shutil

sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'xar'))
import xar

import xml.etree.ElementTree as ET

# Check that an error is reported when the version of a package component is empty.

test_displayed_name="distribution > packages > settings > tag > version - empty"

# Given

dirname = os.path.dirname(__file__)
projectpath = os.path.join(dirname, 'test_distribution_packages_settings_tag_version_empty.pkgproj')

# When

process = subprocess.Popen(['/usr/local/bin/packagesbuild', '--project', projectpath ],
                     stdout=subprocess.PIPE, 
                     stderr=subprocess.PIPE)
stdout, stderr = process.communicate()


# Then

expected_error_line='The version of the package can not be empty.'

build_directory=os.path.join(dirname, 'build')

found=False

for line in stdout.splitlines():
    
    if (line == expected_error_line):
        found = True
        break

if (found == True):
	print("[+] " + test_displayed_name + ": " + '\033[1m' + "Success" + '\033[0m')
else:
    print("[-] " + test_displayed_name + ": " + '\033[91m' + "Failure" + '\033[0m')

# Cleanup

shutil.rmtree(build_directory)

sys.exit()

#!/usr/bin/env python2

import os
import errno
import sys
import subprocess
import shutil

sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'xar'))
import xar

import xml.etree.ElementTree as ET

# Check that an error is reported when the version of a package component is empty.

test_displayed_name="distribution > packages > settings > tag > version - empty"

# Given

dirname = os.path.dirname(__file__)
projectpath = os.path.join(dirname, 'test_distribution_packages_settings_tag_version_empty.pkgproj')

# When

process = subprocess.Popen(['/usr/local/bin/packagesbuild', '--project', projectpath ],
                     stdout=subprocess.PIPE, 
                     stderr=subprocess.PIPE)
stdout, stderr = process.communicate()


# Then

expected_error_line='The version of the package can not be empty.'

build_directory=os.path.join(dirname, 'build')

found=False

for line in stdout.splitlines():
    
    if (line == expected_error_line):
        found = True
        break

if (found == True):
	print("[+] " + test_displayed_name + ": " + '\033[1m' + "Success" + '\033[0m')
else:
    print("[-] " + test_displayed_name + ": " + '\033[91m' + "Failure" + '\033[0m')

# Cleanup

shutil.rmtree(build_directory)

sys.exit()
#!/usr/bin/env python2 # Check that an error is reported when the version of a package component is empty. # Given # When # Then # Cleanup