Skip to content

Commit 91b2f34

Browse files
committed
Change project structure
1 parent 040f0d0 commit 91b2f34

File tree

107 files changed

+47
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+47
-35
lines changed

.travis.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,18 @@ sudo: false
66

77
python:
88
- "2.7"
9-
- "3.4"
109
- "3.5"
1110
- "3.6"
12-
# Disabled for now since cause more pain than gain
13-
# - "pypy"
14-
# - "pypy3"
11+
- "3.7"
1512

1613
cache:
1714
- pip
1815

1916
install:
20-
- travis_retry pip install -q codecov
21-
- pip install flake8
2217
- pip install -r requirements-dev.txt
2318

2419
script:
25-
- pytest --doctest-modules behavioral/ creational/ dft/ fundamental/ other/ structural/ # exclude tests/
20+
- pytest --doctest-modules patterns/
2621
- pytest -s -vv --cov=. --log-level=INFO tests/
2722
# Actually run all the scripts, contributing to coverage
2823
- PYTHONPATH=. ./run_all.sh
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

patterns/structural/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

requirements-dev.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
-e .
12
pytest~=4.1
23
pytest-cov~=2.6
4+
flake8~=3.6
5+
codecov~=2.0

setup.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='python-patterns',
5+
description='A collection of design patterns and idioms in Python.',
6+
classifiers=[
7+
'Programming Language :: Python :: 2',
8+
'Programming Language :: Python :: 2.7',
9+
'Programming Language :: Python :: 3',
10+
'Programming Language :: Python :: 3.5',
11+
'Programming Language :: Python :: 3.6',
12+
'Programming Language :: Python :: 3.7',
13+
],
14+
)

tests/test_command.py renamed to tests/behavioral/test_command.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import shutil
55
import unittest
6-
from behavioral.command import MoveFileCommand
6+
from patterns.behavioral.command import MoveFileCommand
77

88

99
class CommandTest(unittest.TestCase):
@@ -23,8 +23,8 @@ def setUpClass(self):
2323
- get the temporary test directory
2424
- and initializes the command stack.
2525
"""
26-
os.mkdir('tests/test_command')
27-
open('tests/test_command/foo.txt', 'w').close()
26+
os.mkdir('tests/behavioral/test_command')
27+
open('tests/behavioral/test_command/foo.txt', 'w').close()
2828
self.__get_test_directory()
2929
self.command_stack = []
3030
self.command_stack.append(
@@ -56,4 +56,4 @@ def tearDownClass(self):
5656
"""
5757
Remove the temporary directory /test_command and its content.
5858
"""
59-
shutil.rmtree('tests/test_command')
59+
shutil.rmtree('tests/behavioral/test_command')

tests/test_observer.py renamed to tests/behavioral/test_observer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from behavioral.observer import Subject, Data, DecimalViewer, HexViewer
4+
from patterns.behavioral.observer import Subject, Data, DecimalViewer, HexViewer
55

66
try:
77
from unittest.mock import patch

tests/test_publish_subscribe.py renamed to tests/behavioral/test_publish_subscribe.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from behavioral.publish_subscribe import Provider, Publisher, Subscriber
4+
from patterns.behavioral.publish_subscribe import Provider, Publisher, Subscriber
55

66
try:
77
from unittest.mock import patch, call

tests/test_state.py renamed to tests/behavioral/test_state.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from behavioral.state import Radio
4+
from patterns.behavioral.state import Radio
55

66

77
class RadioTest(unittest.TestCase):

tests/test_abstract_factory.py renamed to tests/creational/test_abstract_factory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from creational.abstract_factory import PetShop, Dog
4+
from patterns.creational.abstract_factory import PetShop, Dog
55

66
try:
77
from unittest.mock import patch

tests/test_borg.py renamed to tests/creational/test_borg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from creational.borg import Borg, YourBorg
4+
from patterns.creational.borg import Borg, YourBorg
55

66

77
class BorgTest(unittest.TestCase):

tests/test_builder.py renamed to tests/creational/test_builder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from creational.builder import construct_building, House, Flat, ComplexHouse
4+
from patterns.creational.builder import construct_building, House, Flat, ComplexHouse
55

66

77
class TestSimple(unittest.TestCase):

tests/test_factory_method.py renamed to tests/creational/test_factory_method.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from creational.factory_method import get_localizer
4+
from patterns.creational.factory_method import get_localizer
55

66

77
class TestLocalizer(unittest.TestCase):

tests/test_lazy.py renamed to tests/creational/test_lazy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
from __future__ import print_function
44
import unittest
5-
from creational.lazy_evaluation import Person
5+
from patterns.creational.lazy_evaluation import Person
66

77

88
class TestDynamicExpanding(unittest.TestCase):

tests/test_pool.py renamed to tests/creational/test_pool.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import queue
77
except ImportError: # python 2.x compatibility
88
import Queue as queue
9-
from creational.pool import ObjectPool
9+
from patterns.creational.pool import ObjectPool
1010

1111

1212
class TestPool(unittest.TestCase):

tests/test_prototype.py renamed to tests/creational/test_prototype.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from creational.prototype import Prototype, PrototypeDispatcher
4+
from patterns.creational.prototype import Prototype, PrototypeDispatcher
55

66

77
class TestPrototypeFeatures(unittest.TestCase):

tests/test_constructor_injection.py renamed to tests/dft/test_constructor_injection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
import unittest
44

5-
from dft.constructor_injection import TimeDisplay, MidnightTimeProvider, ProductionCodeTimeProvider, datetime
5+
from patterns.dft.constructor_injection import TimeDisplay, MidnightTimeProvider, ProductionCodeTimeProvider, datetime
66

77
"""
88
Port of the Java example of "Constructor Injection" in

tests/test_parameter_injection.py renamed to tests/dft/test_parameter_injection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
import unittest
44

5-
from dft.parameter_injection import TimeDisplay, MidnightTimeProvider, ProductionCodeTimeProvider, datetime
5+
from patterns.dft.parameter_injection import TimeDisplay, MidnightTimeProvider, ProductionCodeTimeProvider, datetime
66

77
"""
88
Port of the Java example of "Parameter Injection" in

tests/test_setter_injection.py renamed to tests/dft/test_setter_injection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
import unittest
44

5-
from dft.setter_injection import TimeDisplay, MidnightTimeProvider, ProductionCodeTimeProvider, datetime
5+
from patterns.dft.setter_injection import TimeDisplay, MidnightTimeProvider, ProductionCodeTimeProvider, datetime
66

77
"""
88
Port of the Java example of "Setter Injection" in

tests/test_adapter.py renamed to tests/structural/test_adapter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from structural.adapter import Dog, Cat, Human, Car, Adapter
4+
from patterns.structural.adapter import Dog, Cat, Human, Car, Adapter
55

66

77
class ClassTest(unittest.TestCase):

tests/test_bridge.py renamed to tests/structural/test_bridge.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from structural.bridge import DrawingAPI1, DrawingAPI2, CircleShape
4+
from patterns.structural.bridge import DrawingAPI1, DrawingAPI2, CircleShape
55

66
try:
77
from unittest.mock import patch

tests/test_decorator.py renamed to tests/structural/test_decorator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from structural.decorator import TextTag, BoldWrapper, ItalicWrapper
4+
from patterns.structural.decorator import TextTag, BoldWrapper, ItalicWrapper
55

66

77
class TestTextWrapping(unittest.TestCase):

tests/test_facade.py renamed to tests/structural/test_facade.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from io import StringIO
88
except ImportError:
99
from StringIO import StringIO
10-
from structural.facade import TestRunner, TC1, TC2, TC3
10+
from patterns.structural.facade import TestRunner, TC1, TC2, TC3
1111

1212

1313
class TestRunnerFacilities(unittest.TestCase):

tests/test_flyweight.py renamed to tests/structural/test_flyweight.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from structural.flyweight import Card
4+
from patterns.structural.flyweight import Card
55

66

77
class TestCard(unittest.TestCase):

tests/test_proxy.py renamed to tests/structural/test_proxy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
from time import time
55
import unittest
6-
from structural.proxy import Proxy, NoTalkProxy
6+
from patterns.structural.proxy import Proxy, NoTalkProxy
77

88
if sys.version_info[0] == 2:
99
from StringIO import StringIO

tests/test_hsm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4-
from other.hsm.hsm import (
4+
from patterns.other.hsm.hsm import (
55
HierachicalStateMachine,
66
UnsupportedMessageType,
77
UnsupportedState,

tests/test_outputs.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
import pytest
1010

11-
from behavioral.visitor import main as visitor_main
12-
from behavioral.visitor import OUTPUT as visitor_output
13-
from behavioral.strategy import main as strategy_main
14-
from behavioral.strategy import OUTPUT as strategy_output
11+
from patterns.behavioral.visitor import main as visitor_main
12+
from patterns.behavioral.visitor import OUTPUT as visitor_output
13+
from patterns.behavioral.strategy import main as strategy_main
14+
from patterns.behavioral.strategy import OUTPUT as strategy_output
1515

1616
@pytest.mark.skipif(sys.version_info < (3,4),
1717
reason="requires python3.4 or higher")

0 commit comments

Comments
 (0)