AppTest: test & build interactive Python data apps faster

Hi @digitalghost-dev, two options (I think):

  • If you want to run the mapbox calls in your CI, you can set a secret value in the test using AppTest.secrets["MAPBOX_TOKEN"] = "{token}" (or whatever the right key is). Obviously you don’t want to commit the actual token in your test. You could load the secret from an environment variable and then set it in your workflow as described here.
  • If you don’t need to test the actual mapbox call in your CI, a common approach would be to mock that call in the test using unittest.patch. You can see an example doing this for a langchain OpenAI API call here.

These would be the general approaches to use for API calls. I’m not sure if it’s exactly the right recommendation for your use case. If you want to provide a fuller example (such as example code or pointer to a repo) I’d be happy to take a closer look. It might make sense to start a new topic for that discussion and just tag me there :slight_smile: Hope this is helpful! Cheers

Edit: For any other interested readers, find the longer discussion and solution for this question here

2 Likes