This file contains hidden or 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
#!/usr/bin/env bash | |
# A dummy script incorporated to a gist for the sake of simplicity to install srm. | |
# Credit: http://techies-world.com/install-srm-secure-remove-command/ | |
cd "$(mktemp -d)" || exit | |
echo "Starting to download srm file..." | |
sudo apt install build-essential | |
wget http://downloads.sourceforge.net/project/srm/1.2.15/srm-1.2.15.tar.gz | |
tar -zxvf srm-1.2.15.tar.gz | |
cd srm-1.2.15 || exit |
This file contains hidden or 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
from unittest.mock import patch | |
from core.utils import list_dirs_only | |
# specify what should be patched | |
# i.e. if one wants to mock datetime.datetime but it used by your module x.py | |
# then it required to mock x.datetime but not datetime.datetime | |
patcher = patch('__main__.list_dirs_only') | |
# attach the original function to the variable because it will be modified | |
# when the patcher will start |
This file contains hidden or 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
from unittest.mock import patch | |
from core.utils import list_dirs_only | |
# specify what should be patched | |
# i.e. if one wants to mock datetime.datetime but it used by your module x.py | |
# then it required to mock x.datetime but not datetime.datetime | |
patcher = patch('__main__.list_dirs_only') | |
# attach the original function to the variable because it will be modified | |
# when the patcher will start |
This file contains hidden or 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
from unittest.mock import patch | |
from core import utils | |
# specify what should be patched | |
patcher = patch('core.utils.PythonFilesLookUp') | |
# attach the original class to the variable because it will be modified | |
# when the patcher will start | |
original = utils.PythonFilesLookUp | |
# start the patcher and mock the class, this will produce a mock |
This file contains hidden or 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
#!/usr/bin/env bash | |
STATUS="$(sudo systemctl status systemd-resolved.service)" | |
# Stops the service if systemd-resolv.service is running. | |
if echo "${STATUS}" | grep -q "running" | |
then | |
sudo systemctl stop systemd-resolved.service > /dev/null 2>&1 | |
if sudo systemctl status systemd-resolved.service | grep -q "inactive" | |
then |
This file contains hidden or 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
#!/bin/bash | |
cd /tmp || exit | |
echo "Downloading Postman ..." | |
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz && \ | |
tar -xzf postman.tar.gz && \ | |
rm postman.tar.gz | |
echo "Installing to ~/.local/opt..." | |
test -d ~/.local/opt || mkdir ~/.local/opt | |
test -d ~/.local/opt/Postman && rm -rf ~/.local/opt/Postman |
This file contains hidden or 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
#!bin/bash | |
cat > ~/.pdbrc.py <<EOF | |
import pdb | |
class Config(pdb.DefaultConfig): | |
sticky_by_default = True | |
truncate_long_lines = False | |
EOF |
This file contains hidden or 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
==================================================================== test session starts ===================================================================== | |
platform linux -- Python 3.6.9, pytest-5.3.2, py-1.8.0, pluggy-0.13.1 | |
rootdir: /home/vald/Projects/personal/doctests_discovery | |
collected 4 items | |
tests/test_models.py . [ 25%] | |
tests/test_package_doctests.py F [ 50%] | |
tests/test_views.py .F [100%] | |
========================================================================== FAILURES ========================================================================== |
This file contains hidden or 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
. | |
โโโ app | |
โย ย โโโ __init__.py | |
โย ย โโโ models.py | |
โย ย โโโ views.py | |
โโโ tests | |
โโโ __init__.py | |
โโโ test_models.py | |
โโโ test_views.py |
This file contains hidden or 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
import doctest | |
import unittest | |
# Paths to one's Python modules | |
from app import models, views | |
def test_doctest_suit(): | |
test_suit = unittest.TestSuite() | |
test_suit.addTest(doctest.DocTestSuite(models)) |