Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8ac8fbd

Browse filesBrowse files
authored
Wrote some unit tests and enabled Travis-CI. (GH-37)
1 parent 2867c42 commit 8ac8fbd
Copy full SHA for 8ac8fbd

File tree

Expand file treeCollapse file tree

4 files changed

+65
-0
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+65
-0
lines changed

‎.travis.yml

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: python
2+
cache: pip
3+
python:
4+
- 3.6
5+
- 3.6-dev
6+
- 3.7-dev
7+
- nightly
8+
9+
install:
10+
- python3 -m pip install -U -r dev-requirements.txt
11+
script:
12+
- python3 -m pytest tests/
13+

‎dev-requirements.txt

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r requirements.txt
2+
pytest~=3.0.7
3+
pytest-asyncio~=0.5.0
4+
pytest-aiohttp~=0.1.3

‎tests/__init__.py

Copy file name to clipboardExpand all lines: tests/__init__.py
Whitespace-only changes.

‎tests/test_util.py

Copy file name to clipboard
+48Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from unittest import mock
2+
3+
4+
from backport import util
5+
6+
7+
def test_title_normalization():
8+
title = "abcd"
9+
body = "1234"
10+
assert util.normalize_title(title, body) == title
11+
12+
title = "[2.7] bpo-29243: Fix Makefile with respect to --enable-optimizations …"
13+
body = "…(GH-1478)\r\n\r\nstuff"
14+
expected = '[2.7] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478)'
15+
assert util.normalize_title(title, body) == expected
16+
17+
title = "[2.7] bpo-29243: Fix Makefile with respect to --enable-optimizations …"
18+
body = "…(GH-1478)"
19+
assert util.normalize_title(title, body) == expected
20+
21+
title = "[2.7] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-14…"
22+
body = "…78)"
23+
assert util.normalize_title(title, body) == expected
24+
25+
26+
def test_get_participants_different_creator_and_committer():
27+
assert util.get_participants("miss-islington", "bedevere-bot") \
28+
== "@miss-islington and @bedevere-bot"
29+
30+
31+
def test_get_participants_same_creator_and_committer():
32+
assert util.get_participants("miss-islington",
33+
"miss-islington") == "@miss-islington"
34+
35+
36+
@mock.patch('subprocess.check_output')
37+
def test_is_cpython_repo_contains_first_cpython_commit(subprocess_check_output):
38+
mock_output = b"""commit 7f777ed95a19224294949e1b4ce56bbffcb1fe9f
39+
Author: Guido van Rossum <guido@python.org>
40+
Date: Thu Aug 9 14:25:15 1990 +0000
41+
42+
Initial revision"""
43+
subprocess_check_output.return_value = mock_output
44+
assert util.is_cpython_repo()
45+
46+
47+
def test_is_not_cpython_repo():
48+
assert util.is_cpython_repo() == False

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.