Skip to content

Commit

Permalink
Added tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
excitoon committed Aug 27, 2022
1 parent 00b1968 commit a972f41
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Black

on:
push:
branches: [master]

pull_request:
branches: [master]

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Test with black
run: |
pip3 install black
black --check .
61 changes: 61 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: OS X

on:
push:
branches: [master]

pull_request:
branches: [master]

jobs:
python-37-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-38-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-39-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-310-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
61 changes: 61 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Linux

on:
push:
branches: [master]

pull_request:
branches: [master]

jobs:
python-37-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-38-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-39-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-310-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
61 changes: 61 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Windows

on:
push:
branches: [master]

pull_request:
branches: [master]

jobs:
python-37-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-38-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-39-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
python-310-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Test with unittest
run: |
pip3 install -r requirements.txt
python3 -m unittest discover
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/3_py.egg-info/
/build/
/dist/
__pycache__/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# `3`

[![Black](https://github.com/excitoon/3/actions/workflows/black.yml/badge.svg)](https://github.com/excitoon/3/actions/workflows/black.yml)
[![Linux](https://github.com/excitoon/3/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/excitoon/3/actions/workflows/ubuntu.yml)
[![OS X](https://github.com/excitoon/3/actions/workflows/macos.yml/badge.svg)](https://github.com/excitoon/3/actions/workflows/macos.yml)
[![Windows](https://github.com/excitoon/3/actions/workflows/windows.yml/badge.svg)](https://github.com/excitoon/3/actions/workflows/windows.yml)
[![PyPI](https://badge.fury.io/py/3-py.svg)](https://badge.fury.io/py/3-py)

`.gitignore`-aware tree tool written in Python.

Example:
Expand Down
Binary file modified examples/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gitignore-parser
gitignorefile
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development",
"Topic :: Terminals",
"Topic :: Utilities",
Expand Down
42 changes: 42 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os
import subprocess
import unittest
import unittest.mock


class Test3(unittest.TestCase):
def test_simple(self):
env = {k: v for k, v in os.environ.items() if not k.endswith("_COLORS")}
env["PYTHONUTF8"] = "1"
process = subprocess.run(
os.path.abspath("3"),
shell=True,
env=env,
stdout=subprocess.PIPE,
)
self.assertEqual(process.returncode, 0)
self.assertEqual(
process.stdout,
"""
.
├── .github
│ └── workflows
│ ├── black.yml
│ ├── macos.yml
│ ├── ubuntu.yml
│ └── windows.yml
├── .gitignore
├── 3
├── 3.cmd
├── examples
│ └── 3.png
├── LICENSE.md
├── pyproject.toml
├── README.md
├── requirements.txt
├── setup.py
└── tests.py
3 directories, 14 files
""".lstrip().encode(),
)

0 comments on commit a972f41

Please sign in to comment.