File tree 2 files changed +17
-7
lines changed
2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ set -e
4
+
3
5
# capture the changed files that have been staged
4
6
changed_files=$( git diff --staged --name-only)
5
7
6
8
for file in ${changed_files}
7
9
do
8
10
if [[ " ${file##* .} " == " py" ]]; then
9
- echo " Yapfing ${file} "
10
- yapf ${file} -i
11
- git add ${file}
11
+ if command -v yapf > /dev/null; then
12
+ echo " Run yapf on ${file} "
13
+ yapf ${file} -i
14
+ git add ${file}
15
+ fi
16
+
17
+ if command -v flake8 > /dev/null; then
18
+ echo " Run flake8 on ${file} "
19
+ flake8 ${file}
20
+ fi
12
21
fi
13
22
done
23
+
Original file line number Diff line number Diff line change 46
46
47
47
def util_exists (util ):
48
48
def good_properties (f ):
49
- return (os .path .exists (f ) and
50
- os .path .isfile (f ) and
49
+ return (os .path .exists (f ) and # noqa: W504
50
+ os .path .isfile (f ) and # noqa: W504
51
51
os .access (f , os .X_OK )) # yapf: disable
52
52
53
53
# try to resolve it
@@ -72,7 +72,7 @@ def removing(f):
72
72
class TestgresTests (unittest .TestCase ):
73
73
def test_node_repr (self ):
74
74
with get_new_node () as node :
75
- pattern = ' PostgresNode\(name=\ ' .+\ ' , port=.+, base_dir=\ ' .+\ ' \)'
75
+ pattern = r" PostgresNode\(name='.+', port=.+, base_dir='.+'\)"
76
76
self .assertIsNotNone (re .match (pattern , str (node )))
77
77
78
78
def test_custom_init (self ):
@@ -263,7 +263,7 @@ def test_psql(self):
263
263
# check feeding input
264
264
node .safe_psql ('create table horns (w int)' )
265
265
node .safe_psql (
266
- 'copy horns from stdin (format csv)' , input = b"1\n 2\n 3\n \.\n " )
266
+ 'copy horns from stdin (format csv)' , input = b"1\n 2\n 3\n \\ .\n " )
267
267
_sum = node .safe_psql ('select sum(w) from horns' )
268
268
self .assertEqual (_sum , b'6\n ' )
269
269
You can’t perform that action at this time.
0 commit comments