Giter Club home page Giter Club logo

add-automated-tests-off-platform-project's Introduction

BankAccount

This is an educational public repository to illustrate the power of automated testing through Github Actions.

Run locally

  1. Set up Python virtual environment.
python -m venv venv
  1. Install required dependencies.
pip install -r requirements.txt
  1. Run unit tests.
python -m pytest
  1. Run the app.
python app.py

Code Description

  1. app.py: A flask application that exposes the following API endpoints:
  • index at / : Retun a JSON data structure indicating the current balance.
  • deposit at /deposit : Take the deposit amount as a URL parameter and return the new balance after adding the amount.
  • withdraw at /withdraw : Take the withdrawal amount as a URL parameter and return the new balance after subtracting the amount. App relies on a global in-memory variable (balance) to store the balance of the account.
  1. requirements.txt: A text file including all the Python libraries and packages needed to run the app.

  2. .gitignore: Refer to the gitignore article for more details. In short, this file makes it possible that local configuration or binary files are not pushed to the repository.

  3. tests: It's a directory that includes several unit tests for the APIs. The tests utilize the PyTest library.

add-automated-tests-off-platform-project's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

add-automated-tests-off-platform-project's Issues

[BUG] Error: Version 3.10.0 with arch x64 not found

hey team,

when I ran the command git push --set-upstream origin "add-auto-tests" while following the instructions on the codeacademy - https://www.codecademy.com/courses/learn-git/articles/github-actions-tutorial-on-automated-testing

my GitHub actions returned the error message Error: Version 3.10.0 with arch x64 not found attached.
Screenshot 2024-02-10 at 1 02 39 PM

if the python-version on the unittests.yaml file could be updated to a version that's currently available in the following [library][https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json], that would be greatly appreciated.

thank you

contents of unittests.yaml file in add-automated-tests-off-platform-project/.github/workflows/unittests.yaml

name: Continuous Integration
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.10.0
          architecture: x64
      - name: Install dependencies
        run: pip install -r requirements.txt 
      - name: Run Tests
        run: python -m pytest

Update to Python version 3.11.0

Set up Python fails using 3.10.0

Updating the yaml file to use 3.11.0 successfully runs the test

name: Continuous Integration
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.11.0
          architecture: x64
      - name: Install dependencies
        run: pip install -r requirements.txt 
      - name: Run Tests
        run: python -m pytest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.