當前位置: 首頁>>代碼示例>>Python>>正文


Python pytest.xfail方法代碼示例

本文整理匯總了Python中pytest.xfail方法的典型用法代碼示例。如果您正苦於以下問題:Python pytest.xfail方法的具體用法?Python pytest.xfail怎麽用?Python pytest.xfail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pytest的用法示例。


在下文中一共展示了pytest.xfail方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_status_update

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_status_update(self, path1):
        # not a mark because the global "pytestmark" will end up overwriting a mark here
        pytest.xfail("svn-1.7 has buggy 'status --xml' output")
        r = path1
        try:
            r.update(rev=1)
            s = r.status(updates=1, rec=1)
            # Comparing just the file names, because paths are unpredictable
            # on Windows. (long vs. 8.3 paths)
            import pprint
            pprint.pprint(s.allpath())
            assert r.join('anotherfile').basename in [item.basename for
                                                    item in s.update_available]
            #assert len(s.update_available) == 1
        finally:
            r.update() 
開發者ID:pytest-dev,項目名稱:py,代碼行數:18,代碼來源:test_svnwc.py

示例2: test_incdec

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_incdec(self, incdec, value, url, config_stub):
        if (value == '{}foo' and
                url == 'http://example.com/path with {} spaces'):
            pytest.xfail("https://github.com/qutebrowser/qutebrowser/issues/4917")

        config_stub.val.url.incdec_segments = ['host', 'path', 'query',
                                               'anchor']

        # The integer used should not affect test output, as long as it's
        # bigger than 1
        # 20 was chosen by dice roll, guaranteed to be random
        base_value = value.format(20)
        if incdec == 'increment':
            expected_value = value.format(21)
        else:
            expected_value = value.format(19)

        base_url = QUrl(url.format(base_value))
        expected_url = QUrl(url.format(expected_value))

        assert navigate.incdec(base_url, 1, incdec) == expected_url 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:23,代碼來源:test_navigate.py

示例3: test_setitem_series_bool

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_setitem_series_bool(self, val, exp_dtype):
        obj = pd.Series([True, False, True, False])
        assert obj.dtype == np.bool

        if exp_dtype is np.int64:
            exp = pd.Series([True, True, True, False])
            self._assert_setitem_series_conversion(obj, val, exp, np.bool)
            pytest.xfail("TODO_GH12747 The result must be int")
        elif exp_dtype is np.float64:
            exp = pd.Series([True, True, True, False])
            self._assert_setitem_series_conversion(obj, val, exp, np.bool)
            pytest.xfail("TODO_GH12747 The result must be float")
        elif exp_dtype is np.complex128:
            exp = pd.Series([True, True, True, False])
            self._assert_setitem_series_conversion(obj, val, exp, np.bool)
            pytest.xfail("TODO_GH12747 The result must be complex")

        exp = pd.Series([True, val, True, False])
        self._assert_setitem_series_conversion(obj, val, exp, exp_dtype) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:21,代碼來源:test_coercion.py

示例4: test_insert_index_datetimes

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_insert_index_datetimes(self, fill_val, exp_dtype):
        obj = pd.DatetimeIndex(['2011-01-01', '2011-01-02', '2011-01-03',
                                '2011-01-04'], tz=fill_val.tz)
        assert obj.dtype == exp_dtype

        exp = pd.DatetimeIndex(['2011-01-01', fill_val.date(), '2011-01-02',
                                '2011-01-03', '2011-01-04'], tz=fill_val.tz)
        self._assert_insert_conversion(obj, fill_val, exp, exp_dtype)

        msg = "Passed item and index have different timezone"
        if fill_val.tz:
            with pytest.raises(ValueError, match=msg):
                obj.insert(1, pd.Timestamp('2012-01-01'))

        with pytest.raises(ValueError, match=msg):
            obj.insert(1, pd.Timestamp('2012-01-01', tz='Asia/Tokyo'))

        msg = "cannot insert DatetimeIndex with incompatible label"
        with pytest.raises(TypeError, match=msg):
            obj.insert(1, 1)

        pytest.xfail("ToDo: must coerce to object") 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:24,代碼來源:test_coercion.py

示例5: test_replace_series_datetime_tz

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_replace_series_datetime_tz(self):
        how = 'series'
        from_key = 'datetime64[ns, US/Eastern]'
        to_key = 'timedelta64[ns]'

        index = pd.Index([3, 4], name='xxx')
        obj = pd.Series(self.rep[from_key], index=index, name='yyy')
        assert obj.dtype == from_key

        if how == 'dict':
            replacer = dict(zip(self.rep[from_key], self.rep[to_key]))
        elif how == 'series':
            replacer = pd.Series(self.rep[to_key], index=self.rep[from_key])
        else:
            raise ValueError

        result = obj.replace(replacer)
        exp = pd.Series(self.rep[to_key], index=index, name='yyy')
        assert exp.dtype == to_key

        tm.assert_series_equal(result, exp)

    # TODO(jreback) commented out to only have a single xfail printed 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:25,代碼來源:test_coercion.py

示例6: test_transform_numeric_ret

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_transform_numeric_ret(cols, exp, comp_func, agg_func):
    if agg_func == 'size' and isinstance(cols, list):
        pytest.xfail("'size' transformation not supported with "
                     "NDFrameGroupy")

    # GH 19200
    df = pd.DataFrame(
        {'a': pd.date_range('2018-01-01', periods=3),
         'b': range(3),
         'c': range(7, 10)})

    result = df.groupby('b')[cols].transform(agg_func)

    if agg_func == 'rank':
        exp = exp.astype('float')

    comp_func(result, exp) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:19,代碼來源:test_transform.py

示例7: test_td64arr_mod_int

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_td64arr_mod_int(self, box_with_array):
        tdi = timedelta_range('1 ns', '10 ns', periods=10)
        tdarr = tm.box_expected(tdi, box_with_array)

        expected = TimedeltaIndex(['1 ns', '0 ns'] * 5)
        expected = tm.box_expected(expected, box_with_array)

        result = tdarr % 2
        tm.assert_equal(result, expected)

        with pytest.raises(TypeError):
            2 % tdarr

        if box_with_array is pd.DataFrame:
            pytest.xfail("DataFrame does not have __divmod__ or __rdivmod__")

        result = divmod(tdarr, 2)
        tm.assert_equal(result[1], expected)
        tm.assert_equal(result[0], tdarr // 2) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:21,代碼來源:test_timedelta64.py

示例8: test_td64arr_rmod_tdscalar

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_td64arr_rmod_tdscalar(self, box_with_array, three_days):
        tdi = timedelta_range('1 Day', '9 days')
        tdarr = tm.box_expected(tdi, box_with_array)

        expected = ['0 Days', '1 Day', '0 Days'] + ['3 Days'] * 6
        expected = TimedeltaIndex(expected)
        expected = tm.box_expected(expected, box_with_array)

        result = three_days % tdarr
        tm.assert_equal(result, expected)

        if box_with_array is pd.DataFrame:
            pytest.xfail("DataFrame does not have __divmod__ or __rdivmod__")

        result = divmod(three_days, tdarr)
        tm.assert_equal(result[1], expected)
        tm.assert_equal(result[0], three_days // tdarr)

    # ------------------------------------------------------------------
    # Operations with invalid others 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:22,代碼來源:test_timedelta64.py

示例9: test_dt64arr_aware_sub_dt64ndarray_raises

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_dt64arr_aware_sub_dt64ndarray_raises(self, tz_aware_fixture,
                                                  box_with_array):
        if box_with_array is pd.DataFrame:
            pytest.xfail("FIXME: ValueError with transpose; "
                         "alignment error without")

        tz = tz_aware_fixture
        dti = pd.date_range('2016-01-01', periods=3, tz=tz)
        dt64vals = dti.values

        dtarr = tm.box_expected(dti, box_with_array)

        with pytest.raises(TypeError):
            dtarr - dt64vals
        with pytest.raises(TypeError):
            dt64vals - dtarr

    # -------------------------------------------------------------
    # Addition of datetime-like others (invalid) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:21,代碼來源:test_datetime64.py

示例10: test_dt64arr_add_dt64ndarray_raises

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_dt64arr_add_dt64ndarray_raises(self, tz_naive_fixture,
                                            box_with_array):
        if box_with_array is pd.DataFrame:
            pytest.xfail("FIXME: ValueError with transpose; "
                         "alignment error without")

        tz = tz_naive_fixture
        dti = pd.date_range('2016-01-01', periods=3, tz=tz)
        dt64vals = dti.values

        dtarr = tm.box_expected(dti, box_with_array)

        with pytest.raises(TypeError):
            dtarr + dt64vals
        with pytest.raises(TypeError):
            dt64vals + dtarr 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:18,代碼來源:test_datetime64.py

示例11: test_pretty_unicomb

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_pretty_unicomb():
    pytest.xfail('pp_list counts code points, not grapheme clusters.')
    labels = ['name', 'age', 'favourite food']
    table = [
        ['Spot', 3, 'kibble'],
        ['Skruffles', 2, 'kibble'],
        ['Zorb', 2, 'zorblaxian kibble'],
        ['Zörb', 87, 'zørblaχian ﻛبﻞ'],
        [u'Zörb', 42, u'zörblǎxïǎn kïbble'],
        ['Zörb', 87, 'zørblaχian ﻛِبّﻞ'],
    ]
    out = StringIO.StringIO()
    pretty.pp_list(out, table, labels)
    assert out.getvalue() == \
        u'     name | age |    favourite food\n' \
        u'----------+-----+------------------\n' \
        u'     Spot |   3 |            kibble\n' \
        u'Skruffles |   2 |            kibble\n' \
        u'     Zorb |   2 | zorblaxian kibble\n' \
        u'     Zörb |  42 | zörblǎxïǎn kïbble\n' \
        u'     Zörb |  87 |    zørblaxian ﻛِبّﻞ\n' 
開發者ID:probcomp,項目名稱:bayeslite,代碼行數:23,代碼來源:test_pretty.py

示例12: test_compressions

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_compressions(fmt, mode, tmpdir):
    if fmt == "zip" and sys.version_info < (3, 6):
        pytest.xfail("zip compression requires python3.6 or higher")

    tmpdir = str(tmpdir)
    fn = os.path.join(tmpdir, ".tmp.getsize")
    fs = LocalFileSystem()
    f = OpenFile(fs, fn, compression=fmt, mode="wb")
    data = b"Long line of readily compressible text"
    with f as fo:
        fo.write(data)
    if fmt is None:
        assert fs.size(fn) == len(data)
    else:
        assert fs.size(fn) != len(data)

    f = OpenFile(fs, fn, compression=fmt, mode=mode)
    with f as fo:
        if mode == "rb":
            assert fo.read() == data
        else:
            assert fo.read() == data.decode() 
開發者ID:intake,項目名稱:filesystem_spec,代碼行數:24,代碼來源:test_local.py

示例13: test_glob_weird_characters

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_glob_weird_characters(tmpdir, sep, chars):
    tmpdir = make_path_posix(str(tmpdir))

    subdir = tmpdir + sep + "test" + chars + "x"
    try:
        os.makedirs(subdir, exist_ok=True)
    except OSError as e:
        if WIN and "label syntax" in str(e):
            pytest.xfail("Illegal windows directory name")
        else:
            raise
    with open(subdir + sep + "tmp", "w") as f:
        f.write("hi")

    out = LocalFileSystem().glob(subdir + sep + "*")
    assert len(out) == 1
    assert "/" in out[0]
    assert "tmp" in out[0] 
開發者ID:intake,項目名稱:filesystem_spec,代碼行數:20,代碼來源:test_local.py

示例14: test_client_reliablity

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def test_client_reliablity(options):
    """
    Testing validation function of WebGear API
    """
    client = None
    try:
        # define params
        client = NetGear(
            pattern=1, port=5554, receive_mode=True, logging=True, **options
        )
        # get data without any connection
        frame_client = client.recv()
        # check for frame
        if frame_client is None:
            raise RuntimeError
    except Exception as e:
        if isinstance(e, (RuntimeError)):
            pytest.xfail("Reconnection ran successfully.")
        else:
            logger.exception(str(e))
    finally:
        # clean resources
        if not (client is None):
            client.close() 
開發者ID:abhiTronix,項目名稱:vidgear,代碼行數:26,代碼來源:test_netgear.py

示例15: spawn

# 需要導入模塊: import pytest [as 別名]
# 或者: from pytest import xfail [as 別名]
def spawn(self, cmd, expect_timeout=10.0):
        """Run a command using pexpect.

        The pexpect child is returned.

        """
        pexpect = pytest.importorskip("pexpect", "3.0")
        if hasattr(sys, "pypy_version_info") and "64" in platform.machine():
            pytest.skip("pypy-64 bit not supported")
        if sys.platform.startswith("freebsd"):
            pytest.xfail("pexpect does not work reliably on freebsd")
        logfile = self.tmpdir.join("spawn.out").open("wb")

        # Do not load user config.
        env = os.environ.copy()
        env.update(self._env_run_update)

        child = pexpect.spawn(cmd, logfile=logfile, env=env)
        self.request.addfinalizer(logfile.close)
        child.timeout = expect_timeout
        return child 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:23,代碼來源:pytester.py


注:本文中的pytest.xfail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。