2020-09-27

How to use cached dependencies for python unit tests?

I'm curious how one would go about accessing cached dependencies to used in the context of a unit test or just any sort of script execution. I have tried just caching, building and running the tests but then I get import not found errors. I understand there are keys to access the caches but I guess I don't understand how I would call up cached dependencies for a test. Azure seems to know which cache to talk to when it is building the deployment just fine too. This works until the Test step. Also this is for github actions, but I am using it with Azure hence the Pipeline reference. I am a huge n00b when it comes to devops, but I didn't see this question when I looked around.

name: Build and deploy Python app to Azure Web App

on:
  push:
    branches:
      - production

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@master

    - name: Set up Python version
      uses: actions/setup-python@v1
      with:
        python-version: '3.8'

    - name: Cache
      uses: actions/cache@v2.1.1
      with:
        # A list of files, directories, and wildcard patterns to cache and restore
        path: $(Pipeline.Workspace)/.pip
        # An explicit key for restoring and saving the cache
        key: 'python | "$(Agent.OS)" | requirements.txt'
        # An ordered list of keys to use for restoring the cache if no cache hit occurred for key
        restore-keys: | 
          python | "$(Agent.OS)"
          python

    - name: 'Deploy to Azure Web App'
      uses: azure/webapps-deploy@v2
      with:
        app-name: 'integratorapp'
        slot-name: 'production'
        publish-profile: $

    - name: Unit Testing
        run: python test_app.py


from Recent Questions - Stack Overflow https://ift.tt/3i0nu48
https://ift.tt/eA8V8J

No comments:

Post a Comment