code: def test_build(self):
      # 1) Test build when no environment given
      # 2) Test build when definition path exists and given
      # 3) Test build when NO file exists and definition path exists
      # 4) Test build when file exists and definition path exists
      # 5) Test build when file exists but NO definition path exists
      self.project_controller.init("test5", "test description")
      self.environment_controller = EnvironmentController()
      # 1) Test option 1
      failed = False
      try:
          _ = self.environment_controller.build("does_not_exist")
      except EnvironmentDoesNotExist:
          failed = True
      assert failed
  
      # Create environment definition
      definition_filepath = os.path.join(
          self.environment_controller.home, "Dockerfile"
      )
      random_text = str(uuid.uuid1())
      with open(definition_filepath, "wb") as f:
          f.write(to_bytes("FROM python:3.5-alpine" + os.linesep))
          f.write(to_bytes(str("RUN echo " + random_text)))
      input_dict = {
          "paths": [definition_filepath],
      }
  
      # 2) Test option 2
      # Create environment in the project
      environment_obj_1 = self.environment_controller.create(input_dict)
      self.environment_ids.append(environment_obj_1.id)
      result = self.environment_controller.build(environment_obj_1.id)
      assert result
  
      # 3) Test option 3
      # Create environment in the project
      environment_obj_2 = self.environment_controller.create({})
      result = self.environment_controller.build(environment_obj_2.id)
      assert result
  
      # Create script to test
      test_filepath = os.path.join(
          self.environment_controller.home, "script.py"
      )
      with open(test_filepath, "wb") as f:
          f.write(to_bytes("import numpy\n"))
          f.write(to_bytes("import sklearn\n"))
          f.write(to_bytes("print('hello')\n"))
  
      # 4) Test option 4
      environment_obj_3 = self.environment_controller.create({})
      result = self.environment_controller.build(environment_obj_3.id)
      assert result
  
      # test 2), 3), and 4) will result in the same environment
      assert environment_obj_1.id == environment_obj_2.id
      assert environment_obj_2.id == environment_obj_3.id
  
      # Test for building dockerfile when there exists not
      os.remove(definition_filepath)
  
      # 5) Test option 5
      # Create environment definition in project environment directory
      definition_filepath = os.path.join(
          self.environment_controller.environment_driver.environment_directory_path,
          "Dockerfile",
      )
      random_text = str(uuid.uuid1())
      with open(definition_filepath, "wb") as f:
          f.write(to_bytes("FROM python:3.5-alpine" + os.linesep))
          f.write(to_bytes(str("RUN echo " + random_text)))
      environment_obj_4 = self.environment_controller.create({})
      self.environment_ids.append(environment_obj_4.id)
      result = self.environment_controller.build(environment_obj_4.id)
      assert result
  
      # 6) Test option 6
      # Create environment definition in project environment directory with datmo base image
      definition_filepath = os.path.join(
          self.environment_controller.environment_driver.environment_directory_path,
          "Dockerfile",
      )
      random_text = str(uuid.uuid1())
      with open(definition_filepath, "wb") as f:
          f.write(
              to_bytes(
                  "FROM datmo/data-analytics:cpu-py27%s" % os.linesep
              )
          )
          f.write(to_bytes(str("RUN echo " + random_text)))
      environment_obj_4 = self.environment_controller.create({})
      self.environment_ids.append(environment_obj_4.id)
      result = self.environment_controller.build(
          environment_obj_4.id, workspace="notebook"
      )
      assert result
  
imports: import os
  import uuid
  import threading
  import tempfile
  import platform
  import timeout_decorator
  from io import open
  from datmo.config import Config
  from datmo.core.controller.project import ProjectController
  from datmo.core.controller.environment.environment import EnvironmentController
  from datmo.core.entity.environment import Environment
  from datmo.core.util.exceptions import EntityNotFound, RequiredArgumentMissing, TooManyArgumentsFound, FileAlreadyExistsError, UnstagedChanges, EnvironmentDoesNotExist, ProjectNotInitialized
  from datmo.core.util.misc_functions import check_docker_inactive, pytest_docker_environment_failed_instantiation
label_desc: Use image node_id 11 for calling the TestEnvironmentController obj's underlying member method code with example usage: obj.test_build() without return types