Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-1251 Python 3 Support
  3. BEAM-5627

Redesign test_split_at_fraction_exhaustive tests for Python 3

Details

    Description

      ERROR: test_split_at_fraction_exhaustive (apache_beam.io.source_test_utils_test.SourceTestUtilsTest)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/apache_beam/io/source_test_utils_test.py", line 120, in test_split_at_fraction_exhaustive
      source = self._create_source(data)
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/apache_beam/io/source_test_utils_test.py", line 43, in _create_source
      source = LineSource(self._create_file_with_data(data))
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/apache_beam/io/source_test_utils_test.py", line 35, in _create_file_with_data
      f.write(line + '\n')
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/target/.tox/py3/lib/python3.5/tempfile.py", line 622, in func_wrapper
      return func(*args, **kwargs)
      TypeError: a bytes-like object is required, not 'str'

      Also similar:

      ======================================================================
      ERROR: test_file_sink_writing (apache_beam.io.filebasedsink_test.TestFileBasedSink)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/ apache_beam/io/filebasedsink_test.py", line 121, in test_file_sink_writing
      init_token, writer_results = self._common_init(sink)
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/ apache_beam/io/filebasedsink_test.py", line 103, in _common_init
      writer1 = sink.open_writer(init_token, '1')
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/ apache_beam/options/value_provider.py", line 133, in _f
      return fnc(self, *args, **kwargs)
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/ apache_beam/io/filebasedsink.py", line 185, in open_writer
      return FileBasedSinkWriter(self, os.path.join(init_result, uid) + suffix)
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/ apache_beam/io/filebasedsink.py", line 385, in _init_
      self.temp_handle = self.sink.open(temp_shard_path)
      File "/usr/local/google/home/valentyn/projects/beam/clean_head/beam/sdks/python/ apache_beam/io/filebasedsink_test.py", line 82, in open
      file_handle.write('[start]')
      TypeError: a bytes-like object is required, not 'str'

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tvalentyn Valentyn Tymofieiev
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4.5h
                  4.5h