f2a35263aacacf10e1b2d622cd39c7c66ea39acb,src/python/pants/fs/fs_test.py,WorkspaceInConsoleRuleTest,test,#WorkspaceInConsoleRuleTest#,56

Before Change


    return super().rules() + [RootRule(MessageToConsoleRule), workspace_console_rule]

  def test(self):
    with temporary_dir() as tmp_dir:
      input_files_content = InputFilesContent((
        FileContent(path="a.txt", content=b"hello"),
      ))

      msg = MessageToConsoleRule(tmp_dir=tmp_dir, input_files_content=input_files_content)
      output_path = str(Path(tmp_dir, "a.txt"))
      self.assert_console_output_contains(output_path, additional_params=[msg])
      contents = open(output_path).read()
      self.assertEqual(contents, "hello")


//TODO(gshuflin) - it would be nice if this test, which tests that the MaterializeDirectoryResults value
// is valid, could be subsumed into the above @console_rule-based test, but it"s a bit awkward
// to get the MaterializeDirectoriesResult out of a @console_rule at the moment.
class FileSystemTest(TestBase):
  def test_workspace_materialize_directories_result(self):
    //TODO(/񴲀): at some point, this test should require that Workspace only be invoked from a console_role
    workspace = Workspace(self.scheduler)

After Change


    msg = MessageToConsoleRule(
      input_files_content=InputFilesContent([FileContent(path="a.txt", content=b"hello")])
    )
    output_path = Path(self.build_root, "a.txt")
    self.assert_console_output_contains(str(output_path), additional_params=[msg])
    assert output_path.read_text() == "hello"

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: pantsbuild/pants
Commit Name: f2a35263aacacf10e1b2d622cd39c7c66ea39acb
Time: 2019-11-25
Author: ericarellano@me.com
File Name: src/python/pants/fs/fs_test.py
Class Name: WorkspaceInConsoleRuleTest
Method Name: test


Project Name: matplotlib/matplotlib
Commit Name: 1f09d1866cafb3e16e628f9f1bfd91471acc0988
Time: 2018-05-29
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/backends/backend_nbagg.py
Class Name: FigureManagerNbAgg
Method Name: get_javascript


Project Name: matplotlib/matplotlib
Commit Name: 1f09d1866cafb3e16e628f9f1bfd91471acc0988
Time: 2018-05-29
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/backends/backend_webagg_core.py
Class Name: FigureManagerWebAgg
Method Name: get_javascript