Ejemplo n.º 1
0
 def test_evaluate_pep345_markers(self, marker_string, environment,
                                  expected):
     args = [] if environment is None else [environment]
     assert Marker(marker_string).evaluate(*args) == expected
Ejemplo n.º 2
0
 def test_extra_with_no_extra_in_environment(self):
     # We can't evaluate an extra if no extra is passed into the environment
     m = Marker("extra == 'security'")
     with pytest.raises(UndefinedEnvironmentName):
         m.evaluate()
Ejemplo n.º 3
0
 def test_parses_pep345_valid(self, marker_string):
     Marker(marker_string)
Ejemplo n.º 4
0
 def test_extra_with_no_extra_in_environment(self):
     # We can't evaluate an extra if no extra is passed into the environment
     m = Marker("extra == 'security'")
     with pytest.raises(UndefinedEnvironmentName):
         m.evaluate()
Ejemplo n.º 5
0
 def test_compare_markers_to_other_objects(self):
     # Markers should not be comparable to other kinds of objects.
     assert Marker("os_name == 'nt'") != "os_name == 'nt'"
Ejemplo n.º 6
0
 def test_different_markers_different_hashes(self, example1, example2):
     marker1, marker2 = Marker(example1), Marker(example2)
     # Markers created from strings that are not equivalent should differ.
     assert marker1 != marker2
     # Different Marker objects should have different hashes.
     assert hash(marker1) != hash(marker2)
Ejemplo n.º 7
0
 def test_parses_invalid(self, marker_string):
     with pytest.raises(InvalidMarker):
         Marker(marker_string)