Giter Site home page Giter Site logo

pytest-demo's Introduction

Overview

This is a sample project to show of the capabilities of the pytest framework.

Source code and a sample etl job is under src/ and test examples are under test/.

The etl job read a public s3 bucket that contains New York City taxi data, runs a passenger count summation on the data, and stores the result on the local filesystem under a new folder ./data.

Installation

In a new virtual environment, run

> pip install -r requirements.txt -r requirements-dev.txt

Configuration

The script needs two environment variables that correspond to the report that needs to be processed. Taxi reports are a monthly job.

  • MONTH
  • YEAR

See the bucket!

Running

From inside the src directory, run

> env MONTH=01 YEAR=2019 python -m taxi_trips

Unit Tests

From the project directory run

> tox

Integration Tests

From the project directory run

> tox -e integration

Test Structure

Within the test package:

  • test_pytest_basics.py contains an overview of pytest features
  • conftest.py contains shared pytest fixtures
  • test_passenger_count.py contains unit test for the sample job
  • test_passenger_count_integration.py contains an example integration test for the job

If you're new to pytest, test_pytest_basics.py is a good place to start!

pytest-demo's People

Contributors

grantcooksey avatar

Watchers

 avatar

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.