# -*- coding: utf-8 -*-

def test_bar_fixture(testdir):
    testdir.tmpdir.join('test_foo.py').write('''
def test_a(bar):
    assert bar == "something"
'''
    result = testdir.runpytest('--foo=something')


def test_foo_option():
    pass

# -*- coding: utf-8 -*-

def test_bar_fixture(testdir):
    """Make sure that pytest accepts our fixture."""

    # create a temporary pytest test module
    testdir.makepyfile("""
        def test_sth(bar):
            assert bar == "europython2015"
    """)

    # run pytest with the following cmd args
    result = testdir.runpytest(
        '--foo=something',
        '-v'
    )

    # fnmatch_lines does an assertion internally
    result.stdout.fnmatch_lines([
        '*::test_a PASSED',
    ])

    # make sure that that we get a '0' exit code for the testsuite
    assert result.ret == 0
    

def test_help_message(testdir):
    result = testdir.runpytest(
        '--help',
    )
    # fnmatch_lines does an assertion internally
    result.stdout.fnmatch_lines([
        'cat:',
        '*--foo=DEST_FOO*Set the value for the fixture "bar".',
    ])

Implement test for help and cli args