File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ set -e
4+
35# capture the changed files that have been staged
46changed_files=$( git diff --staged --name-only)
57
68for file in ${changed_files}
79do
810 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
1221 fi
1322done
23+
Original file line number Diff line number Diff line change 4646
4747def util_exists (util ):
4848 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
5151 os .access (f , os .X_OK )) # yapf: disable
5252
5353 # try to resolve it
@@ -72,7 +72,7 @@ def removing(f):
7272class TestgresTests (unittest .TestCase ):
7373 def test_node_repr (self ):
7474 with get_new_node () as node :
75- pattern = ' PostgresNode\(name=\ ' .+\ ' , port=.+, base_dir=\ ' .+\ ' \)'
75+ pattern = r" PostgresNode\(name='.+', port=.+, base_dir='.+'\)"
7676 self .assertIsNotNone (re .match (pattern , str (node )))
7777
7878 def test_custom_init (self ):
@@ -263,7 +263,7 @@ def test_psql(self):
263263 # check feeding input
264264 node .safe_psql ('create table horns (w int)' )
265265 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 " )
267267 _sum = node .safe_psql ('select sum(w) from horns' )
268268 self .assertEqual (_sum , b'6\n ' )
269269
You can’t perform that action at this time.
0 commit comments