Skip to content

Commit 6dc00ae

Browse files
authored
Replace nose with pytest (#37)
* replace nose with pytest * try to build it without PYTHONPATH
1 parent 7b3173f commit 6dc00ae

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
python -m pip install --upgrade pip
35-
pip install flake8 nose
35+
pip install flake8 pytest
3636
3737
- name: Lint
3838
run: |
@@ -43,4 +43,4 @@ jobs:
4343
4444
- name: Test
4545
run: |
46-
nosetests --with-doctest --doctest-extension=rst
46+
pytest --doctest-modules --doctest-glob='*.rst'

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7-
nose = "*"
7+
pytest = "*"
88
flake8 = "*"
99
twine = "*"
1010
black = "*"

tests/test_apply.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from whatthepatch import exceptions
55
from whatthepatch.snippets import which
66

7-
from nose.tools import assert_raises
7+
import pytest
88
import unittest
99
from unittest.case import SkipTest
1010

@@ -26,7 +26,7 @@ def setUp(self):
2626
self.lao = f.read().splitlines()
2727

2828
with open("tests/casefiles/tzu") as f:
29-
self.tzu = f.read().splitlines()
29+
self.tzu = f.read().splitlines()
3030

3131
def test_truth(self):
3232
self.assertEqual(type(self.lao), list)
@@ -59,10 +59,10 @@ def test_diff_unified_bad(self):
5959
with open("tests/casefiles/diff-unified-bad.diff") as f:
6060
diff_text = f.read()
6161

62-
with assert_raises(exceptions.ApplyException) as ec:
62+
with pytest.raises(exceptions.ApplyException) as ec:
6363
_apply(self.lao, diff_text)
6464

65-
e = ec.exception
65+
e = ec.value
6666
e_str = str(e)
6767
assert "line 4" in e_str
6868
assert "The Named is the mother of all tings." in e_str
@@ -73,10 +73,10 @@ def test_diff_unified_bad2(self):
7373
with open("tests/casefiles/diff-unified-bad2.diff") as f:
7474
diff_text = f.read()
7575

76-
with assert_raises(exceptions.ApplyException) as ec:
76+
with pytest.raises(exceptions.ApplyException) as ec:
7777
_apply(self.lao, diff_text)
7878

79-
e = ec.exception
79+
e = ec.value
8080
e_str = str(e)
8181
assert "line 9" in e_str
8282
assert "The two are te same," in e_str
@@ -87,10 +87,10 @@ def test_diff_unified_bad_backward(self):
8787
with open("tests/casefiles/diff-unified-bad2.diff") as f:
8888
diff_text = f.read()
8989

90-
with assert_raises(exceptions.ApplyException) as ec:
90+
with pytest.raises(exceptions.ApplyException) as ec:
9191
_apply(self.tzu, diff_text)
9292

93-
e = ec.exception
93+
e = ec.value
9494
e_str = str(e)
9595
assert "line 1" in e_str
9696
assert "The Way that can be told of is not the eternal Way;" in e_str
@@ -101,10 +101,10 @@ def test_diff_unified_bad_empty_source(self):
101101
with open("tests/casefiles/diff-unified-bad2.diff") as f:
102102
diff_text = f.read()
103103

104-
with assert_raises(exceptions.ApplyException) as ec:
104+
with pytest.raises(exceptions.ApplyException) as ec:
105105
_apply("", diff_text)
106106

107-
e = ec.exception
107+
e = ec.value
108108
e_str = str(e)
109109
assert "line 1" in e_str
110110
assert "The Way that can be told of is not the eternal Way;" in e_str
@@ -126,7 +126,7 @@ def test_diff_unified_patchutil(self):
126126
new_text = _apply(self.lao, diff_text, use_patch=True)
127127
self.assertEqual(new_text, (self.tzu, None))
128128

129-
with assert_raises(exceptions.ApplyException):
129+
with pytest.raises(exceptions.ApplyException):
130130
_apply([""] + self.lao, diff_text, use_patch=True)
131131

132132
def test_diff_rcs(self):

0 commit comments

Comments
 (0)