summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-06-25 15:51:32 -0700
committerMarcus Müller <marcus@hostalia.de>2018-06-29 09:50:57 +0200
commite3b2944f43ea7cd0a970ac1a3efabe9516171be6 (patch)
tree0d6e3f3a1ac9684fb4fcd81b57ef8eb91eadc109 /gr-blocks/python
parent1d3785f3f2d1619bbdf16c332653192f9e840b6a (diff)
blocks: Fix QA for file_sink on Py3k
open() call was not specifying 'rb' (binary file).
Diffstat (limited to 'gr-blocks/python')
-rw-r--r--gr-blocks/python/blocks/qa_file_sink.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/gr-blocks/python/blocks/qa_file_sink.py b/gr-blocks/python/blocks/qa_file_sink.py
index a7296183ef..36d24bb74b 100644
--- a/gr-blocks/python/blocks/qa_file_sink.py
+++ b/gr-blocks/python/blocks/qa_file_sink.py
@@ -20,11 +20,10 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
import os
import tempfile
-import pmt
import array
+from gnuradio import gr, gr_unittest, blocks
class test_file_sink(gr_unittest.TestCase):
@@ -47,11 +46,11 @@ class test_file_sink(gr_unittest.TestCase):
self.tb.run()
# Check file length (float: 4 * nsamples)
- st = os.stat(temp.name)
- self.assertEqual(st.st_size, 4 * len(data))
+ file_size = os.stat(temp.name).st_size
+ self.assertEqual(file_size, 4 * len(data))
# Check file contents
- datafile = open(temp.name, 'r')
+ datafile = open(temp.name, 'rb')
result_data = array.array('f')
result_data.fromfile(datafile, len(data))
self.assertFloatTuplesAlmostEqual(expected_result, result_data)