Skip to content

Commit

Permalink
Fix relative import module in test file
Browse files Browse the repository at this point in the history
  • Loading branch information
kleo-53 committed Sep 20, 2023
1 parent 97806d2 commit 6202e01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
13 changes: 12 additions & 1 deletion test/test_uploader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import pytest
import pioneer_uploader
import repackage
from unittest.mock import patch

repackage.up()
import pioneer_uploader


@patch("logging.error")
def test_without_file(mock_logging_error):
Expand All @@ -25,5 +28,13 @@ def test_few_arguments(mock_logging_error):
mock_logging_error.assert_called_once_with("Invalid arguments")


@patch("logging.error")
def test_args_format(mock_logging_error):
test_args = ["parameter", "filename.lusa", "127.0.0.1", "8888", "some_mode"]
with patch("sys.argv", test_args):
pioneer_uploader.main()
mock_logging_error.assert_called_once_with("Invalid program file format")


if __name__ == "__main__":
pytest.main()
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tox]
timeout = 120
envlist = linters, py38, py310, latest
skipsdist = true

Expand All @@ -15,11 +16,9 @@ commands =
[testenv]
deps =
-r requirements.txt
repackage
pytest

setenv =
PYTHONPATH = {toxinidir}

[testenv:py38]
basepython = python3.8

Expand Down

0 comments on commit 6202e01

Please sign in to comment.