Skip to content

Commit

Permalink
added .env file for vscode to find test/lib module
Browse files Browse the repository at this point in the history
replace `is not` exp in *_test.py files to suppress python syntax warning with py3
  • Loading branch information
imcom committed Aug 31, 2020
1 parent a4d5d00 commit af37271
Show file tree
Hide file tree
Showing 29 changed files with 31 additions and 53 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PYTHONPATH=./test
2 changes: 1 addition & 1 deletion test/scenario_test/addpath_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def f():

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/aspath_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -173,7 +172,7 @@ def f():

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
4 changes: 1 addition & 3 deletions test/scenario_test/bgp_confederation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# limitations under the License.




import sys
import time
import unittest
Expand Down Expand Up @@ -148,7 +146,7 @@ def test_03_best_path(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/bgp_malformed_msg_handling_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -99,7 +98,7 @@ def test_03_treat_as_withdraw(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/bgp_router_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import json
import sys
import time
Expand Down Expand Up @@ -472,7 +471,7 @@ def test_23_check_withdrawal3(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
4 changes: 2 additions & 2 deletions test/scenario_test/bgp_unnumbered_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import unittest
from lib import base
from lib.base import BGP_FSM_ESTABLISHED, local
Expand Down Expand Up @@ -47,6 +46,7 @@ def setUpClass(cls):
time.sleep(initial_wait_time + 2)

done = False

def f(ifname, ctn):
out = ctn.local('ip -6 n', capture=True)
l = [line for line in out.split('\n') if ifname in line]
Expand Down Expand Up @@ -90,7 +90,7 @@ def test_02_add_ipv4_route(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion test/scenario_test/bgp_zebra_nht_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_07_nexthop_restore(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion test/scenario_test/bgp_zebra_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def validate_nexthops(peers):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/evpn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



from itertools import combinations
import sys
import time
Expand Down Expand Up @@ -144,7 +143,7 @@ def test_04_check_mac_mobility_again(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/flow_spec_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -409,7 +408,7 @@ def test_12_ipv6_gobgp_delete_route(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/global_policy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -291,7 +290,7 @@ def test_18_reject_policy(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/graceful_restart_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -230,7 +229,7 @@ def test_11_multineighbor_graceful_restart(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/ibgp_router_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



from itertools import combinations
import sys
import time
Expand Down Expand Up @@ -292,7 +291,7 @@ def f3():

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/long_lived_graceful_restart_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



from itertools import chain
import sys
import time
Expand Down Expand Up @@ -251,7 +250,7 @@ def test_08_llgr_restart_timer_expire(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
4 changes: 1 addition & 3 deletions test/scenario_test/route_reflector_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -139,7 +138,6 @@ def test_10_setup_rr_rtc_isolation_policy(self):
# | (RR Client) | | (RR Client) | | (RR Client) | | (RR Client) |
# +-------------+ +-------------+ +-------------+ +-------------+


gobgp_ctn_image_name = parser_option.gobgp_image
rr = GoBGPContainer(name='rr', asn=65000, router_id='192.168.1.1',
ctn_image_name=gobgp_ctn_image_name,
Expand Down Expand Up @@ -260,7 +258,7 @@ def test_12_routes_from_separate_rts_peers_are_isolated_by_rr(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_as2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import unittest
import sys
import time
Expand Down Expand Up @@ -110,7 +109,7 @@ def test_03_stop_q2_and_check_neighbor_status(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_ipv4_v6_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -168,7 +167,7 @@ def test_08_check_rib(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_malformed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -543,7 +542,7 @@ def test(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_policy_grpc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -2709,7 +2708,7 @@ def test(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_policy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -3184,7 +3183,7 @@ def test(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_softreset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -135,7 +134,7 @@ def test_03_softresetin_test2(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -250,7 +249,7 @@ def check_nexthop(target_prefix, expected_nexthop):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
3 changes: 1 addition & 2 deletions test/scenario_test/route_server_test2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.



import sys
import time
import unittest
Expand Down Expand Up @@ -101,7 +100,7 @@ def test_04_withdraw_path(self):

if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
if int(output) != 0:
print("docker not found")
sys.exit(1)

Expand Down
Loading

0 comments on commit af37271

Please sign in to comment.