Replaced the print() outputs to the sys.stdout.write()
Change-Id: Ib6dad45ba72383e19a616ca5ed601fb38f0701ce
diff --git a/tests/test_glance.py b/tests/test_glance.py
index 460d900..99db954 100644
--- a/tests/test_glance.py
+++ b/tests/test_glance.py
@@ -1,8 +1,9 @@
-import pytest
-import time
-import subprocess
-import random
import logging
+import pytest
+import random
+import subprocess
+import sys
+import time
import utils
@@ -94,7 +95,7 @@
record_property("Upload", speed_upload)
record_property("Download", speed_download)
- print("++++++++++++++++++++++++++++++++++++++++")
- print(('upload - {} MB/s'.format(speed_upload)))
- print(('download - {} MB/s'.format(speed_download)))
- print("++++++++++++++++++++++++++++++++++++++++")
+ sys.stdout.write("\n++++++++++++++++++++++++++++++++++++++++")
+ sys.stdout.write(('\nupload - {} MB/s'.format(speed_upload)))
+ sys.stdout.write(('\ndownload - {} MB/s'.format(speed_download)))
+ sys.stdout.write("\n++++++++++++++++++++++++++++++++++++++++\n")
diff --git a/tests/test_vm2vm.py b/tests/test_vm2vm.py
index e60a7fd..4367ee8 100644
--- a/tests/test_vm2vm.py
+++ b/tests/test_vm2vm.py
@@ -1,4 +1,5 @@
import logging
+import sys
import time
import pytest
@@ -185,18 +186,17 @@
logger.info("Drawing the table with iperf results...")
result_table.add_rows(table_rows)
- print('\n{}'.format(result_table.draw()))
+ sys.stdout.write('\n{}\n'.format(result_table.draw()))
- print("Removing VMs and FIPs...")
logger.info("Removing VMs and FIPs...")
for vm in vms:
openstack_clients.compute.servers.delete(vm)
- print("Removing FIPs...")
+ logger.info("Removing FIPs...")
for fip in fips:
openstack_clients.compute.floating_ips.delete(fip)
except Exception as e:
- print(e)
- print("Something went wrong")
+ sys.stdout.write("\n{}".format(e))
+ sys.stdout.write("\nSomething went wrong\n")
if 'vms' in locals():
logger.info("Removing VMs...")
for vm in vms:
@@ -206,5 +206,5 @@
for fip in fips:
openstack_clients.compute.floating_ips.delete(fip)
else:
- print("Skipping cleaning, VMs were not created")
+ sys.stdout.write("\nSkipping cleaning, VMs were not created")
pytest.fail("Something went wrong")