コード例 #1
0
ファイル: test.py プロジェクト: pyjarrett/alire
def check_child(version, output, pinned):
    # Verify output
    assert_match('.*\n'
                 'Dependencies \(solution\):\n'
                 '   libchild=' + version + (' \(pinned\)' if pinned else "") +
                 '\n'
                 '   libparent=1\.0\.0\n'
                 '.*\n',
                 output,
                 flags=re.S)

    # Verify lockfile
    check_line_in(alr_lockfile(), 'name = "libchild"')
    check_line_in(alr_lockfile(), f'version = "{version}"')
コード例 #2
0
ファイル: test.py プロジェクト: pyjarrett/alire
def check_child(version, output, pinned):
    # Verify output
    assert_match('.*\n'
                 'Dependencies \(solution\):\n'
                 '   libchild=' + version + (" \(pinned\)" if pinned else "") +
                 '.*\n',
                 output,
                 flags=re.S)

    # Verify lockfile
    check_line_in(alr_lockfile(), 'name = "libchild"')
    check_line_in(alr_lockfile(), f'version = "{version}"')

    # Verify dependency folders
    assert os.path.exists('alire/cache/dependencies/libchild_' + version +
                          '_filesystem')
コード例 #3
0
"""

import os

from drivers.alr import run_alr, alr_pin
from drivers.asserts import assert_eq
from drivers.helpers import check_line_in

# Create a new "xxx" program project
run_alr('init', '--bin', 'xxx')
os.chdir('xxx')

# Make it depend on libhello, it is auto-narrowed down to ^1
session_file = os.path.join('alire.toml')
run_alr('with', 'libhello')
check_line_in(session_file, 'libhello = "^1.0.0"')

# Add the corresponding "with" line in xxx.gpr.
#
# TODO: maybe "alr with" should do that automatically?
with open('xxx.gpr', 'r') as f:
    content = f.read()
with open('xxx.gpr', 'w') as f:
    f.write('with "libhello";\n')
    f.write(content)

# Pin the version of libhello and verify pin is there
alr_pin('libhello', version='1.0')
p = run_alr('pin')
assert_eq('libhello 1.0.0\n', p.out)
コード例 #4
0
"""

import os

from drivers.alr import run_alr
from drivers.asserts import assert_eq
from drivers.helpers import check_line_in

# Create a new "xxx" program project
run_alr('init', '--bin', 'xxx')
os.chdir('xxx')

# Make it depend on libhello
session_file = os.path.join('alire.toml')
run_alr('with', 'libhello')
check_line_in(session_file,
              'libhello = "*"  # This line was added by `alr with`')

# Add the corresponding "with" line in xxx.gpr.
#
# TODO: maybe "alr with" should do that automatically?
with open('xxx.gpr', 'r') as f:
    content = f.read()
with open('xxx.gpr', 'w') as f:
    f.write('with "libhello";\n')
    f.write(content)

# Pin the version of libhello and verify pin is there
run_alr('pin', 'libhello')
p = run_alr('pin')
assert_eq('libhello 1.0.0\n', p.out)
コード例 #5
0
ファイル: test.py プロジェクト: pyjarrett/alire
"""
Test the with statement for a project file in sub dirs
"""

from glob import glob
import os

from drivers.alr import run_alr
from drivers.asserts import assert_eq, assert_match

import re
import platform
from drivers.helpers import check_line_in

# Get the "hello" project and enter its directory
run_alr('init', '--bin', 'myhello')
os.chdir(glob('myhello*')[0])

# Get dependencies that should also add a with statement in myhello.gpr
run_alr('with', 'libhello')
run_alr('with', 'gpr_in_subdir')

check_line_in('config/myhello_config.gpr', 'with "libhello.gpr";')

# When the crate declares a project file: `dir1/dir2/dir3/prj.gpr`, the with
# statement has to be `with "prj.gpr"`. Without the sub-dirs because
# GPR_PROJECT_PATH is already set with dirs that contain the project file.
check_line_in('config/myhello_config.gpr', 'with "gpr_in_subdir.gpr";')

print('SUCCESS')
コード例 #6
0
"""
Test custom actions for `alr test`
"""

from drivers.alr import run_alr
from drivers.helpers import check_line_in

from glob import glob

from os import chdir

p = run_alr('test', '--continue', 'hello')

# Enter logging folder
chdir(glob('hello*')[0])
chdir('alire')

# Check the magic string in the test output log
check_line_in(glob('*.log')[0], 'ABRACADABRA')

print('SUCCESS')
コード例 #7
0
"""
Test the with statement for a project file in sub dirs
"""

from glob import glob
import os

from drivers.alr import run_alr
from drivers.asserts import assert_eq, assert_match

import re
import platform
from drivers.helpers import check_line_in

# Get the "hello" project and enter its directory
run_alr('init', '--bin', 'myhello')
os.chdir(glob('myhello*')[0])

# Get dependencies that should also add a with statement in myhello.gpr
run_alr('with', 'libhello')
run_alr('with', 'gpr_in_subdir')

check_line_in('myhello.gpr', 'with "libhello.gpr";')

# When the crate declares a project file: `dir1/dir2/dir3/prj.gpr`, the with
# statement has to be `with "prj.gpr"`. Without the sub-dirs because
# GPR_PROJECT_PATH is already set with dirs that contain the project file.
check_line_in('myhello.gpr', 'with "gpr_in_subdir.gpr";')
print('SUCCESS')
コード例 #8
0
ファイル: test.py プロジェクト: pyjarrett/alire
import os

from drivers.alr import run_alr, alr_pin
from drivers.asserts import assert_eq
from drivers.helpers import check_line_in


# Create a new "xxx" program project
run_alr('init', '--bin', 'xxx')
os.chdir('xxx')

# Make it depend on libhello, it is auto-narrowed down to ^1
session_file = os.path.join('alire.toml')
run_alr('with', 'libhello')
check_line_in(session_file,
              'libhello = "^1.0.0"  # Added by alr')

# Add the corresponding "with" line in xxx.gpr.
#
# TODO: maybe "alr with" should do that automatically?
with open('xxx.gpr', 'r') as f:
    content = f.read()
with open('xxx.gpr', 'w') as f:
    f.write('with "libhello";\n')
    f.write(content)

# Pin the version of libhello and verify pin is there
alr_pin('libhello', version='1.0')
p = run_alr('pin')
assert_eq('libhello 1.0.0\n', p.out)