예제 #1
0
    def test_markers_match(self):
        # match
        for markers in (
                'python_version >= "1.0"',
                'sys_platform == %r' % sys.platform,
        ):
            line = 'name; ' + markers
            req = InstallRequirement(line, comes_from='')
            assert str(req.markers) == str(Marker(markers))
            assert req.match_markers()

        # don't match
        for markers in (
                'python_version >= "5.0"',
                'sys_platform != %r' % sys.platform,
        ):
            line = 'name; ' + markers
            req = InstallRequirement(line, comes_from='')
            assert str(req.markers) == str(Marker(markers))
            assert not req.match_markers()
예제 #2
0
파일: test_req.py 프로젝트: dstufft/pip
    def test_markers_match(self):
        # match
        for markers in (
            'python_version >= "1.0"',
            'sys_platform == %r' % sys.platform,
        ):
            line = 'name; ' + markers
            req = InstallRequirement(line, comes_from='')
            assert str(req.markers) == str(Marker(markers))
            assert req.match_markers()

        # don't match
        for markers in (
            'python_version >= "5.0"',
            'sys_platform != %r' % sys.platform,
        ):
            line = 'name; ' + markers
            req = InstallRequirement(line, comes_from='')
            assert str(req.markers) == str(Marker(markers))
            assert not req.match_markers()