Skip to content

Instantly share code, notes, and snippets.

@Longliveping
Longliveping / python_tests_dir_structure.md
Created January 12, 2021 05:59 — forked from tasdikrahman/python_tests_dir_structure.md
Typical Directory structure for python tests

A Typical directory structure for running tests using unittest

Ref : stackoverflow

The best solution in my opinion is to use the unittest [command line interface][1] which will add the directory to the sys.path so you don't have to (done in the TestLoader class).

For example for a directory structure like this:

new_project

├── antigravity.py

import tushare as ts
from datetime import datetime
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
# 利用plotly绘图
import plotly.offline as of
import plotly.graph_objs as go