JosephLai241 / URS

Universal Reddit Scraper - A comprehensive Reddit scraping/archival command-line tool.
https://josephlai241.github.io/URS/
MIT License
780 stars 105 forks source link

Upgrading/refactoring `tests` #31

Closed JosephLai241 closed 3 years ago

JosephLai241 commented 3 years ago

Overview

Summary

This pull request primarily addresses upgrading/refactoring the existing suite of unit tests - coverage has now increased from 69% to 87%.

I have also performed minor refactoring for the source code:

After a bit of confusion, I have also migrated the repository from travis-ci.org to travis-ci.com since they are migrating everything to the .com domain. From my understanding, Travis-CI formerly used the .org domain for open-source projects and the .com domain for enterprise use, but why they did not just host their services on one domain in the first place is beyond me.

Motivation/Context

Travis CI allows setting encrypted environmental variables. Previous iterations did not take advantage of this feature because PRAW API credentials needed to be hard-coded into the deprecated Credentials.py file. After merging pull #26, it is possible for me to write real unit tests using my personal development API credentials since they are now stored in the .env file.

New Dependencies

None

Issue Fix or Enhancement Request

N/A

Type of Change

Breaking Change

N/A

List All Changes That Have Been Made

Added

Changed

Deprecated

How Has This Been Tested?

Test Configuration

Travis CI configuration:

language: python

python:
  - 3.7
  - 3.8
  - 3.9

before_install:
  - python --version
  - pip install -U pip
  - pip install -U pytest pytest-cov
  - pip install -U codecov
  - pip install -r requirements.txt
  - export PYTHONPATH=$PYTHONPATH:$(pwd)

install:
  - pip install .

before_script:
  - rm .env

script:
  - pytest --cov=./

after_success:
  - codecov

env:
  global:
    - secure: "[ENCRYPTED_VARIABLE]"
    - secure: "[ENCRYPTED_VARIABLE]"
    - secure: "[ENCRYPTED_VARIABLE]"
    - secure: "[ENCRYPTED_VARIABLE]"
    - secure: "[ENCRYPTED_VARIABLE]"

Dependencies

N/A

Checklist