当前位置: 首页>>代码示例>>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;未经允许,请勿转载。