Skip to content

Commit

Permalink
- Fixed a problem where the package was not imported correctly. (#7)
Browse files Browse the repository at this point in the history
- Fixed a problem where the package was not imported correctly.
- Fixed a problem where the tests were not comparing config data correctly and failing.
- Update the readme.
- Renamed the base package.
- Updated some dependencies.
 - Fixed a failed linting test.
- Fixed a failing test suite where the import was not done correctly.
  • Loading branch information
mortolian authored Oct 28, 2022
1 parent 39287c8 commit f6113c7
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
pip install -e .
- name: Lint With flake8
run: |
flake8 src/
flake8 backup/
- name: Test With PyTest
run: |
pytest tests/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test: ## Run UNIT and Functional Tests with PyTest.
pytest tests --cov -s

lint: ## Run a code style linter (flake8) over the app code.
flake8 src/
flake8 backup/

clean:
find . -name '.coverage' -delete
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Rsync Backup Automation



This is a small abstraction on the RSYNC command found on Unix or Linux
to automate some repetitive things you have to do when creating complex backups
between two Unix or Linux systems with encryption.
Expand Down Expand Up @@ -119,7 +117,7 @@ From the root of the project folder run the following to get the help
printout of how to use the script.
```commandline
python ./src/backup.py --help
python ./backup/backup.py --help
```
```commandline
usage: Backup Remote Files. [-h] [-j JOB] [-s] [-c CONFIG] [-d]
Expand All @@ -136,14 +134,14 @@ options:

### Run A Job

When you are setup you can run the job with the following command.
When you are set up you can run the job with the following command.

```commandline
python ./src/backup.py -j offsite_1
python ./backup/backup.py -j offsite_1
```
or, if not inside VENV
```commandline
python3 ./src/backup.py -j offsite_1
python3 ./backup/backup.py -j offsite_1
```

You can also simulate the job with a "dry run", to make sure everything
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions src/backup.py → backup/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
import time
import yaml
from termcolor import cprint
from src.data_classes import ConfigDataClass, ConfigListDataClass
from src.exceptions import (PathValidationException, PathNotFoundException,
RemoteSocketNotFoundException,
ConfigJobNotFoundException, RsyncNotFoundException)
from data_classes import ConfigDataClass, ConfigListDataClass
from exceptions import (PathValidationException, PathNotFoundException,
RemoteSocketNotFoundException,
ConfigJobNotFoundException,
RsyncNotFoundException)

RSYNC_VERSION = '2.6.9'
DEFAULT_CONFIG = 'config.yaml'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
flake8==5.0.4
pip-tools==6.8.0
pip-tools==6.9.0
termcolor==2.0.1
pytest==7.1.3
pytest-cov==3.0.0
pytest==7.2.0
pytest-cov==4.0.0
pytest-mock==3.10.0
pyyaml==6.0
build==0.9.0
20 changes: 11 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#
# This file is autogenerated by pip-compile with python 3.10
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile
#
attrs==22.1.0
# via pytest
build==0.8.0
# via pip-tools
build==0.9.0
# via
# -r requirements.in
# pip-tools
click==8.1.3
# via pip-tools
coverage[toml]==6.4.4
coverage[toml]==6.5.0
# via pytest-cov
exceptiongroup==1.0.0
# via pytest
flake8==5.0.4
# via -r requirements.in
iniconfig==1.1.1
Expand All @@ -24,24 +28,22 @@ packaging==21.3
# pytest
pep517==0.13.0
# via build
pip-tools==6.8.0
pip-tools==6.9.0
# via -r requirements.in
pluggy==1.0.0
# via pytest
py==1.11.0
# via pytest
pycodestyle==2.9.1
# via flake8
pyflakes==2.5.0
# via flake8
pyparsing==3.0.9
# via packaging
pytest==7.1.3
pytest==7.2.0
# via
# -r requirements.in
# pytest-cov
# pytest-mock
pytest-cov==3.0.0
pytest-cov==4.0.0
# via -r requirements.in
pytest-mock==3.10.0
# via -r requirements.in
Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


[metadata]
name = RSYNC Backup Automation
version = 2.0.1
name = backup
version = 2.1.0
author = Mortolian
maintainer = Mortolian
keywords = rsync, backup, sync, ssh
Expand All @@ -14,15 +14,15 @@ classifiers =

[options]
package_dir =
=src
=backup
packages = find:
install_requires = file:requirements.txt
zip_safe = False
python_requires = >=3.8


[options.packages.find]
where = src
where = backup


[flake8]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_backup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import subprocess
import pytest
import socket
from src import backup
from src.data_classes import ConfigDataClass, ConfigListDataClass
from backup import backup
from backup.data_classes import ConfigListDataClass, ConfigDataClass

BAD_CONFIG_FILE = """
offsite_1::
Expand Down Expand Up @@ -86,7 +86,7 @@ def mock_config_bad_file(mocker):

def test_read_config(mock_config_good_file) -> None:
result = backup.readConfig(config_file_path='mock_file.yaml')
assert result == CONFIG_DATA_OBJECT
assert repr(result) == repr(CONFIG_DATA_OBJECT)


def test_read_config_key_error(mock_config_bad_file) -> None:
Expand Down

0 comments on commit f6113c7

Please sign in to comment.