Skip to content

Commit a52254c

Browse files
authored
Update PyGithub and other dependencies (#147)
* Various updates * Switch from nose -> pytest * update travis commands * version bump * Update setup.py
1 parent c443c71 commit a52254c

File tree

14 files changed

+88
-105
lines changed

14 files changed

+88
-105
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Changelog
2+
3+
- 0.16
4+
- Update a few Python dependencies that had bitrotted (#147)
5+
16
- 0.15
27
* Fix `setup.py` configuration error that prevented install on macOS Catalina (#131)
38
* JavaScript modernization:

Gruntfile.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,26 @@ This will download the files relevant to the Pull Request and run `webdiff`.
4747
If you run into GitHub API quota limits or you'd like to use webdiff with
4848
private repos, you can set your credentials in a `.githubrc` file:
4949

50-
```
51-
user.login: yourusername
52-
user.token: your-personal-access-tokens
53-
```
50+
user.login: yourusername
51+
user.token: your-personal-access-tokens
5452

5553
Make sure you chmod this file to only be readable by yourself. You can generate
5654
a personal access token for webdiff via github.com → profile → Settings →
5755
Personal access tokens. Make sure to grant all the "repo" privileges.
5856

59-
6057
## Development
6158

62-
(from an activated virtualenv)
63-
59+
python3 -m venv venv
60+
source venv/bin/activate
6461
pip install -r requirements.txt
6562
cd ts
6663
yarn
67-
webpack
64+
# see https://github.com/webpack/webpack/issues/14532
65+
NODE_OPTIONS=--openssl-legacy-provider webpack
6866

6967
Then from the root directory:
7068

71-
./webdiff/app.py testdata/dygraphsjs/{left,right}
69+
PYTHONPATH=. ./webdiff/app.py testdata/dygraphsjs/{left,right}
7270

7371
or to launch in debug mode:
7472

@@ -78,7 +76,7 @@ or to launch in debug mode:
7876

7977
To run the Python tests:
8078

81-
nosetests
79+
pytest
8280

8381
To run the JavaScript tests:
8482

@@ -103,11 +101,11 @@ To iterate on the PyPI package, run:
103101

104102
deactivate
105103
cd /tmp/webdiff-test
106-
pip install webdiff-X.Y.Z.tar.gz
104+
pip3 install webdiff-X.Y.Z.tar.gz
107105

108106
To publish to pypitest:
109107

110-
pip install --upgraede wheel setuptools twine
108+
pip install --upgrade wheel setuptools twine
111109
python setup.py sdist bdist_wheel
112110
twine upload -r testpypi dist/*
113111

@@ -117,5 +115,4 @@ And to the real pypi:
117115

118116
See [pypirc][] docs for details on setting up `~/.pypirc`.
119117

120-
[oauth]: https://github.com/danvk/webdiff/issues/103
121118
[pypirc]: https://packaging.python.org/specifications/pypirc/

bower.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
flask==0.10.1
2-
nose
3-
PyGithub==1.25.2
1+
flask==2.2.2
2+
pytest==7.1.3
3+
PyGithub==1.55
44
pillow
55
requests
66
binaryornot

scripts/black.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
black --line-length 99 --skip-string-normalization webdiff
3+
black --line-length 99 --skip-string-normalization webdiff tests

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
setup(name='webdiff',
9-
version='0.15.0',
9+
version='0.16.0',
1010
description='Two-column web-based git difftool',
1111
long_description=long_description,
1212
long_description_content_type='text/markdown',
@@ -22,10 +22,10 @@
2222
packages=find_packages(exclude=['tests*']),
2323
install_requires=[
2424
'binaryornot',
25-
'flask',
25+
'flask==2.2.2',
2626
'pillow',
2727
'requests',
28-
'PyGithub==1.25.2'
28+
'PyGithub==1.55'
2929
],
3030
include_package_data=True,
3131
package_data = {

test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
22
export WEBDIFF_CONFIG=$(pwd)/testing.cfg
33
export WEBDIFF_PORT=$(($RANDOM + 10000))
4+
export PYTHONPATH=.
45
./webdiff/app.py $*

tests/argparser_test.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,40 @@
22

33
import tempfile
44
import os
5-
from nose.tools import *
5+
import pytest
66

77
_, file1 = tempfile.mkstemp()
88
_, file2 = tempfile.mkstemp()
99
dir1 = tempfile.mkdtemp()
1010
dir2 = tempfile.mkdtemp()
1111

12+
1213
def test_file_dir_pairs():
13-
eq_({'files': (file1, file2)}, argparser.parse([file1, file2]))
14-
eq_({'dirs': (dir1, dir2)}, argparser.parse([dir1, dir2]))
14+
assert {'files': (file1, file2)} == argparser.parse([file1, file2])
15+
assert {'dirs': (dir1, dir2)} == argparser.parse([dir1, dir2])
1516

16-
with assert_raises(argparser.UsageError):
17+
with pytest.raises(argparser.UsageError):
1718
argparser.parse([file1, dir1])
18-
with assert_raises(argparser.UsageError):
19+
with pytest.raises(argparser.UsageError):
1920
argparser.parse([dir2, file2])
2021

2122

2223
def test_port():
23-
eq_({'files': (file1, file2), 'port': 12345},
24-
argparser.parse(['--port', '12345', file1, file2]))
24+
assert {'files': (file1, file2), 'port': 12345} == argparser.parse(
25+
['--port', '12345', file1, file2]
26+
)
2527

2628

2729
def test_github_pull_request():
28-
eq_({'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}},
29-
argparser.parse(['https://github.com/danvk/dygraphs/pull/292']))
30-
eq_({'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}},
31-
argparser.parse(['https://github.com/danvk/dygraphs/pull/292/']))
32-
eq_({'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}},
33-
argparser.parse(['https://github.com/danvk/dygraphs/pull/292/files']))
34-
eq_({'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}},
35-
argparser.parse(['https://github.com/danvk/dygraphs/pull/292/commits']))
30+
assert {'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}} == argparser.parse(
31+
['https://github.com/danvk/dygraphs/pull/292']
32+
)
33+
assert {'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}} == argparser.parse(
34+
['https://github.com/danvk/dygraphs/pull/292/']
35+
)
36+
assert {'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}} == argparser.parse(
37+
['https://github.com/danvk/dygraphs/pull/292/files']
38+
)
39+
assert {'github': {'owner': 'danvk', 'repo': 'dygraphs', 'num': 292}} == argparser.parse(
40+
['https://github.com/danvk/dygraphs/pull/292/commits']
41+
)

tests/pair_test.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import unittest
22

3-
from nose.tools import *
43
from webdiff import util
54
from webdiff import diff
65
from webdiff import dirdiff
76

7+
88
def test_pairing():
99
a_files = [
1010
'app.py',
1111
'TODO',
1212
'static/js/file_diff.js',
1313
'static/jsdifflib/diffview.css',
1414
'static/jsdifflib/diffview.js',
15-
'templates/heartbeat.html']
15+
'templates/heartbeat.html',
16+
]
1617

1718
b_files = [
1819
'app.py',
@@ -21,30 +22,33 @@ def test_pairing():
2122
'static/js/file_diff.js',
2223
'static/jsdifflib/diffview.css',
2324
'static/jsdifflib/diffview.js',
24-
'templates/heartbeat.html']
25+
'templates/heartbeat.html',
26+
]
2527

2628
pairs = dirdiff.pair_files(a_files, b_files)
2729
pairs.sort()
2830

29-
eq_(
30-
[('', 'testing.cfg'),
31-
('TODO', 'TODO'),
32-
('app.py', 'app.py'),
33-
('static/js/file_diff.js', 'static/js/file_diff.js'),
34-
('static/jsdifflib/diffview.css', 'static/jsdifflib/diffview.css'),
35-
('static/jsdifflib/diffview.js', 'static/jsdifflib/diffview.js'),
36-
('templates/heartbeat.html', 'templates/heartbeat.html'),
37-
], pairs)
31+
assert [
32+
('', 'testing.cfg'),
33+
('TODO', 'TODO'),
34+
('app.py', 'app.py'),
35+
('static/js/file_diff.js', 'static/js/file_diff.js'),
36+
('static/jsdifflib/diffview.css', 'static/jsdifflib/diffview.css'),
37+
('static/jsdifflib/diffview.js', 'static/jsdifflib/diffview.js'),
38+
('templates/heartbeat.html', 'templates/heartbeat.html'),
39+
] == pairs
3840

3941

4042
def test_pairing_with_move():
4143
testdir = 'testdata/renamedfile'
4244
diffs = dirdiff.diff('%s/left/dir' % testdir, '%s/right/dir' % testdir)
43-
eq_([{
44-
'a': 'file.json',
45-
'b': 'renamed.json',
46-
'type': 'move',
47-
}], [diff.get_thin_dict(d) for d in diffs])
45+
assert [
46+
{
47+
'a': 'file.json',
48+
'b': 'renamed.json',
49+
'type': 'move',
50+
}
51+
] == [diff.get_thin_dict(d) for d in diffs]
4852

4953

5054
class TinyDiff(object):
@@ -54,10 +58,10 @@ def __init__(self, a, b):
5458

5559

5660
def test_is_image_diff():
57-
assert diff.is_image_diff(TinyDiff('foo.png', 'bar.png'))
61+
assert diff.is_image_diff(TinyDiff('foo.png', 'bar.png'))
5862
assert not diff.is_image_diff(TinyDiff('foo.png.gz', 'bar.png.gz'))
5963
assert not diff.is_image_diff(TinyDiff('foo.txt', 'bar.txt'))
60-
assert diff.is_image_diff(TinyDiff('foo.png', ''))
64+
assert diff.is_image_diff(TinyDiff('foo.png', ''))
6165
assert not diff.is_image_diff(TinyDiff('foo.txt', ''))
62-
assert diff.is_image_diff(TinyDiff('', 'foo.png'))
66+
assert diff.is_image_diff(TinyDiff('', 'foo.png'))
6367
assert not diff.is_image_diff(TinyDiff('', 'foo.txt'))

0 commit comments

Comments
 (0)