
import subprocess as subp


class DependencyChecker(object):

    def _check_test_dependencies(self):
        for dep in self.DEPENDENCIES:
            cmd = 'if hash {} 2/dev/null; then ' \
                  'echo 1; else echo 0; fi'.format(dep)
            available = subp.check_output(cmd, shell=True, stderr=subp.STDOUT)
            available = available.strip() is '1'
            if not available:
                error = "The required test dependency '{0}'" \
                        " is not available.".format(dep)
                self.fail(error)


import sys
import subprocess as subp


class DependencyChecker(object):

    def _check_test_dependencies(self):
        for dep in self.DEPENDENCIES:
            cmd = 'if hash {} 2/dev/null; then ' \
                  'echo 1; else echo 0; fi'.format(dep)
            available = subp.check_output(cmd, shell=True, stderr=subp.STDOUT)
            if sys.version_info >= (3, 3) and isinstance(available, bytes):
                available = available.decode('utf-8')
            available = available.strip() is '1'
            if not available:
                error = "The required test dependency '{0}'" \
                        " is not available.".format(dep)
                self.fail(error)

Fix binary to str conversion
release/0.6.2: Fix binary to str conversion

  
+ import sys
  import subprocess as subp
  
  
  class DependencyChecker(object):
  
      def _check_test_dependencies(self):
          for dep in self.DEPENDENCIES:
              cmd = 'if hash {} 2/dev/null; then ' \
                    'echo 1; else echo 0; fi'.format(dep)
              available = subp.check_output(cmd, shell=True, stderr=subp.STDOUT)
+             if sys.version_info >= (3, 3) and isinstance(available, bytes):
+                 available = available.decode('utf-8')
              available = available.strip() is '1'
              if not available:
                  error = "The required test dependency '{0}'" \
                          " is not available.".format(dep)
                  self.fail(error)
  
Fix binary to str conversion
## Code Before:

import subprocess as subp


class DependencyChecker(object):

    def _check_test_dependencies(self):
        for dep in self.DEPENDENCIES:
            cmd = 'if hash {} 2/dev/null; then ' \
                  'echo 1; else echo 0; fi'.format(dep)
            available = subp.check_output(cmd, shell=True, stderr=subp.STDOUT)
            available = available.strip() is '1'
            if not available:
                error = "The required test dependency '{0}'" \
                        " is not available.".format(dep)
                self.fail(error)

## Instruction:
Fix binary to str conversion
## Code After:

import sys
import subprocess as subp


class DependencyChecker(object):

    def _check_test_dependencies(self):
        for dep in self.DEPENDENCIES:
            cmd = 'if hash {} 2/dev/null; then ' \
                  'echo 1; else echo 0; fi'.format(dep)
            available = subp.check_output(cmd, shell=True, stderr=subp.STDOUT)
            if sys.version_info >= (3, 3) and isinstance(available, bytes):
                available = available.decode('utf-8')
            available = available.strip() is '1'
            if not available:
                error = "The required test dependency '{0}'" \
                        " is not available.".format(dep)
                self.fail(error)
