Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 11, 2023
1 parent 49bdc6c commit 18e76f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions repo2docker/buildpacks/r.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# that seems to have a working IRKernel.
RSPM_CUTOFF_DATE = datetime.date(2018, 12, 7)


class RBuildPack(PythonBuildPack):
"""
Setup R for use with a repository
Expand Down Expand Up @@ -270,9 +271,9 @@ def get_build_scripts(self):
"""
if self.checkpoint_date < RSPM_CUTOFF_DATE:
raise RuntimeError(
f'Microsoft killed MRAN, the source of R package snapshots before {RSPM_CUTOFF_DATE.strftime("%Y-%m-%d")}. '\
f'This repo has a snapshot date of {self.checkpoint_date.strftime("%Y-%m-%d")} specified in runtime.txt. '\
'Please use a newer snapshot date'
f'Microsoft killed MRAN, the source of R package snapshots before {RSPM_CUTOFF_DATE.strftime("%Y-%m-%d")}. '
f'This repo has a snapshot date of {self.checkpoint_date.strftime("%Y-%m-%d")} specified in runtime.txt. '
"Please use a newer snapshot date"
)

cran_mirror_url = self.get_rspm_snapshot_url(self.checkpoint_date)
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/test_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ def test_mran_dead(tmpdir, base_image):
tmpdir.chdir()

with open("runtime.txt", "w") as f:
f.write('r-3.6-2017-06-04')
f.write("r-3.6-2017-06-04")

r = buildpacks.RBuildPack(base_image)
with pytest.raises(RuntimeError, match=r'^Microsoft killed MRAN, the source of R package snapshots before 2018-12-07.*'):
r.get_build_scripts()
with pytest.raises(
RuntimeError,
match=r"^Microsoft killed MRAN, the source of R package snapshots before 2018-12-07.*",
):
r.get_build_scripts()

0 comments on commit 18e76f9

Please sign in to comment.