<commit_before>require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class InProgressBuildStatusTest < Test::Unit::TestCase
  include FileSandbox

  def test_build_started_creates_file
    setup_using_filename("some filename")
    status = InProgressBuildStatus.new(nil)
    @mock_build.stubs(:label).returns("a build label")
    File.expects(:open).with("some filename", 'w')
    status.build_started(@mock_build)
  end
  
  def test_build_finished_creates_deletion_marker_file
    begin
      in_total_sandbox do
        full_path_file_name=Dir.pwd + "./some other filename"
        setup_using_filename(full_path_file_name)
        status = InProgressBuildStatus.new(nil)
        deletion_marker = full_path_file_name + InProgressBuildStatus::DELETION_MARKER_FILE_SUFFIX
        status.build_finished(@mock_build)
        assert File.exists?(deletion_marker)
      end
    rescue Exception => e
      raise e,  "Maybe build_finished() did not close or unlock the file?\n\n" + e.message
    end
  end
  
  private
  def setup_using_filename(name)
    @mock_build = Object.new
    @mock_project = Object.new
    @mock_project.expects(:in_progress_build_status_file).at_least(1).returns(name)
    @mock_build.expects(:project).at_least(1).returns(@mock_project)
  end
end<commit_msg>Fixing build: Test used a path that is not valid on linux/unix boxes.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class InProgressBuildStatusTest < Test::Unit::TestCase
  include FileSandbox

  def test_build_started_creates_file
    setup_using_filename("some filename")
    status = InProgressBuildStatus.new(nil)
    @mock_build.stubs(:label).returns("a build label")
    File.expects(:open).with("some filename", 'w')
    status.build_started(@mock_build)
  end
  
  def test_build_finished_creates_deletion_marker_file
    begin
      in_total_sandbox do
        full_path_file_name = File.join(Dir.pwd, "some_other_filename")
        setup_using_filename(full_path_file_name)
        status = InProgressBuildStatus.new(nil)
        deletion_marker = full_path_file_name + InProgressBuildStatus::DELETION_MARKER_FILE_SUFFIX
        status.build_finished(@mock_build)
        assert File.exists?(deletion_marker)
      end
    rescue Exception => e
      raise e,  "Maybe build_finished() did not close or unlock the file?\n\n" + e.message
    end
  end
  
  private
  def setup_using_filename(name)
    @mock_build = Object.new
    @mock_project = Object.new
    @mock_project.expects(:in_progress_build_status_file).at_least(1).returns(name)
    @mock_build.expects(:project).at_least(1).returns(@mock_project)
  end
end
{'fraction_non_alphanumeric': 0.09384384384384384, 'fraction_numerical': 0.0015015015015015015, 'mean_word_length': 4.256410256410256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '663036', 'n_tokens_mistral': 865, 'n_tokens_neox': 849, 'n_words': 148}