How to use the pytest.mark.xfail function in pytest

To help you get started, we’ve selected a few pytest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github carpyncho / feets / tests / extractors / test_expected_FATS_doc.py View on Github external
@pytest.mark.xfail(reason="FATS say must be 2/pi, but actual is -0.20")
def test_FATS_doc_StetsonK():
    random = np.random.RandomState(42)

    ext = extractors.StetsonK()
    values = np.empty(1000)
    for idx in range(values.size):
        mags = random.normal(size=1000)
        errors = random.normal(scale=0.001, size=1000)
        values[idx] = ext.fit(magnitude=mags, error=errors)["StetsonK"]
    np.testing.assert_allclose(values.mean(), 0.798)
github pfultz2 / cget / test / test_cget.py View on Github external
@pytest.mark.xfail(strict=True)
def test_shared_static_init(d):
    d.cmds(install_cmds(init='--shared --static', url=get_exists_path('libsimple'), lib='simple'))
github translate / translate / translate / convert / test_po2prop.py View on Github external
    @mark.xfail(reason="This doesn't work as expected right now")
    def test_no_separator(self):
        """check that we can handle keys without separator"""
        posource = '''#: KEY\nmsgctxt "KEY"\nmsgid ""\nmsgstr ""\n'''
        proptemplate = '''KEY\n'''
        propexpected = '''KEY\n'''
        propfile = self.merge2prop(proptemplate, posource)
        print(propfile)
        assert propfile == propexpected
github andialbrecht / sqlparse / tests / test_format.py View on Github external
    @pytest.mark.xfail(reason="Needs fixing")
    def test_python_multiple_statements_with_formatting(self):
        sql = 'select * from foo; select 1 from dual'
        f = lambda sql: sqlparse.format(sql, output_format='python',
                                        reindent=True)
        assert f(sql) == '\n'.join([
            "sql = ('select * '",
            "       'from foo;')",
            "sql2 = ('select 1 '",
            "        'from dual')"])
github Pelagicore / softwarecontainer / servicetest / filesystem / test_filesystem.py View on Github external
    @pytest.mark.xfail("platform.release() <= \"3.18.0\"")
    @pytest.mark.parametrize("flag", [True, False])
    def test_bindmount_files(self, flag):
        """ Test that files are bindmountable as expected.
        """
        absoluteTestFile = os.path.join(CURRENT_DIR, TESTFILE)

        if not os.path.exists(absoluteTestFile):
            f = open(absoluteTestFile, "w")
            f.write("gobbles")
            f.close()

        ca = Container()
        if flag is True:
            DATA[Container.CONFIG] = '[{"enableWriteBuffer": true}]'
        else:
            DATA[Container.CONFIG] = '[{"enableWriteBuffer": false}]'
github nucypher / pyUmbral / tests / test_umbral.py View on Github external
@pytest.mark.xfail(raises=InvalidTag)    # remove this mark to fail instead of ignore
@pytest.mark.parametrize("curve", secp_curves)
@pytest.mark.parametrize("N, M", parameters)
def test_simple_api_on_multiple_curves(N, M, curve):
    test_simple_api(N, M, curve)
github hgrecco / pint / pint / testsuite / test_pandas_interface.py View on Github external
        @pytest.mark.xfail(run=True, reason="s.combine does not accept arrays")
        def test_arith_series_with_array(self, data, all_arithmetic_operators):
            # ndarray & other series
            op_name, exc = self._get_exception(data, all_arithmetic_operators)
            s = pd.Series(data)
            self.check_opname(s, op_name, data, exc=exc)
github python-telegram-bot / python-telegram-bot / tests / test_bot.py View on Github external
    @pytest.mark.xfail(raises=RetryAfter)
    @pytest.mark.skipif(python_implementation() == 'PyPy',
                        reason='Unstable on pypy for some reason')
    def test_send_contact(self, bot, chat_id):
        phone_number = '+11234567890'
        first_name = 'Leandro'
        last_name = 'Toledo'
        message = bot.send_contact(chat_id=chat_id, phone_number=phone_number,
                                   first_name=first_name, last_name=last_name)

        assert message.contact
        assert message.contact.phone_number == phone_number
        assert message.contact.first_name == first_name
        assert message.contact.last_name == last_name
github mozilla / treeherder / tests / model / derived / test_objectstore_model.py View on Github external
@pytest.mark.xfail
def test_objectstore_update_content(jm, sample_data):
    """
    Test updating an object of the objectstore.
    """
    original_obj = sample_data.job_data[100]
    jm.store_job_data([original_obj])

    obj_updated = original_obj.copy()
    obj_updated["job"]["state"] = "pending"

    jm.store_job_data([obj_updated])

    stored_objs = jm.get_os_dhub().execute(
        proc="objectstore_test.selects.row_by_guid",
        placeholders=[obj_updated["job"]["job_guid"]]
    )
github librosa / librosa / tests / test_sequence.py View on Github external
# diag is correct
        assert np.allclose(np.diag(A), p)

        # we have well-formed distributions
        assert np.all(A >= 0)
        assert np.allclose(A.sum(axis=1), 1)

    # Test with constant self-loops
    for n in range(2, 4):
        yield __trans, n, 0.5

    # Test with variable self-loops
    yield __trans, 3, [0.8, 0.7, 0.5]

    # Failure if we don't have enough states
    tf = pytest.mark.xfail(__trans, raises=librosa.ParameterError)
    yield tf, 1, 0.5

    # Failure if n_states is wrong
    yield tf, None, 0.5

    # Failure if p is not a probability
    yield tf, 3, 1.5
    yield tf, 3, -0.25

    # Failure if there's a shape mismatch
    yield tf, 3, [0.5, 0.2]