-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also update travisci to use pytest. Remove travis testing for python 3.2 and 3.3 since PyTest no longer supports those versions.
- Loading branch information
Showing
6 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,4 @@ history.txt | |
.venv | ||
fake.py | ||
.vscode | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from __future__ import absolute_import | ||
|
||
import os | ||
import sys | ||
import unittest | ||
|
||
|
||
from HowLong.HowLong import Process | ||
|
||
class TestProcess(unittest.TestCase): | ||
def test_command(self): | ||
p = Process(command=["true"]) | ||
assert p.command == "true" | ||
assert p.start_time | ||
|
||
def test_pid(self): | ||
p = Process(os.getpid()) | ||
# Specific command could be dependent on host running test, | ||
# settle for making sure it was filled in at all. | ||
assert p.command | ||
assert p.start_time | ||
|
||
def test_is_running_pid(self): | ||
p = Process(os.getpid()) | ||
assert p.is_running() | ||
|
||
def test_is_running_cmd(self): | ||
p = Process(command=["true"]) | ||
assert p.is_running() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from __future__ import absolute_import | ||
|
||
import unittest | ||
import sys | ||
|
||
from HowLong import HowLong | ||
|
||
def test_red(): | ||
ret = HowLong.red("asdf") | ||
assert ret == '\033[91masdf\033[0m' | ||
|
||
|
||
# While it would be good to also test the printed output, | ||
# dealing with print statement versus print function | ||
# being different across python2 and python3 makes that | ||
# really hard. | ||
class TestErrorAndExit(unittest.TestCase): | ||
def test_no_args(self): | ||
with self.assertRaises(SystemExit): | ||
HowLong.error_and_exit() | ||
|
||
def test_one_arg(self): | ||
with self.assertRaises(SystemExit): | ||
HowLong.error_and_exit("one") | ||
|
||
def test_multi_arg(self): | ||
with self.assertRaises(SystemExit): | ||
HowLong.error_and_exit("one", "two") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
psutil>=5.0.1 | ||
termcolor>=1.1.0 | ||
colorama>=0.3.9 | ||
pytest==3.9.2 | ||
pytest-cov==2.6.0 | ||
six==1.11.0 | ||
mock==2.0.0 | ||
pbr==5.1.0 | ||
-e . |