testthat give error when testing function including reticulate::source_python

I want to test a function with testthat that includes sourcing a python file with reticulate. However, I get the error: Exited with status 9.

This is the python example file called the_py_module.py with function that I want to source.

def f1():
  return "f one"

This is the function sourcing the above file in R:

#' Testing F1 function sourced from python
#' @return "f one"
#' @export
f1_sourced_from_python <- function() {
  reticulate::source_python(system.file("python", "the_py_module.py", package = "test_package", mustWork = TRUE))

This is the testthat set-up, which gives above error:

test_that("Testing sourcing python file in testthat", {
  output <- f1_sourced_from_python()
  expect_that(output, is_a("character"))
Any help is much appreciated.

Please note that it works on Ubuntu and Windows but not on my Mac OS Catalina version 10.15.6.