Skip to content

Commit

Permalink
Merge pull request #752 from betatim/fix-preassemble-r-py-combo
Browse files Browse the repository at this point in the history
[MRG] Call parent preassemble scripts methods
  • Loading branch information
choldgraf authored Jul 23, 2019
2 parents 6c5c09b + e24e5d9 commit bf29f66
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion repo2docker/buildpacks/r.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def get_build_scripts(self):
return super().get_build_scripts() + scripts

def get_preassemble_script_files(self):
files = {}
files = super().get_preassemble_script_files()
installR_path = self.binder_path("install.R")
if os.path.exists(installR_path):
files[installR_path] = installR_path
Expand Down
27 changes: 27 additions & 0 deletions tests/unit/test_preassemble.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

import pytest

from repo2docker import buildpacks


@pytest.mark.parametrize("binder_dir", ["", ".binder", "binder"])
def test_combine_preassemble_steps(tmpdir, binder_dir):
tmpdir.chdir()
if binder_dir:
os.mkdir(binder_dir)

# create two empty files for the build pack to use for pre-assembly
open(os.path.join(binder_dir, "requirements.txt"), "w").close()
open(os.path.join(binder_dir, "install.R"), "w").close()

# trigger R build pack detection
with open(os.path.join(binder_dir, "runtime.txt"), "w") as f:
f.write("r-2019-01-30")

bp = buildpacks.RBuildPack()
files = bp.get_preassemble_script_files()

assert len(files) == 2
assert os.path.join(binder_dir, "requirements.txt") in files
assert os.path.join(binder_dir, "install.R") in files

0 comments on commit bf29f66

Please sign in to comment.