Skip to content

Commit 24eddda

Browse files
committed
Added initial tests for __main__.py
1 parent 94c7dfe commit 24eddda

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

pytest_watch/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
def run_cli():
1313
import os
1414
import sys
15+
1516
sys.path.append(os.path.dirname(__file__))
1617

1718
from pytest_watch.command import main

pytest_watch/tests/test_main.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
import sys
3+
import unittest
4+
5+
try:
6+
from unittest.mock import patch
7+
except ImportError:
8+
from mock import patch
9+
10+
from pytest_watch import __main__
11+
from pytest_watch.__main__ import run_cli
12+
13+
14+
class TestRunCLI(unittest.TestCase):
15+
16+
@patch("pytest_watch.command.main", side_effect=lambda argv: 0)
17+
def test_add_pytest_watch_folder_to_path(self, main):
18+
run_cli()
19+
self.assertIn(os.path.dirname(__main__.__file__), sys.path)
20+

0 commit comments

Comments
 (0)