Hexagonal architecture and Python - Part IV: Lightweight integration tests

Posted on 10 May 2025 in Articles • Tagged with architecture, django, hexagonal architecture, lightweight integration tests, programming, python, testing • 14 min read

Pythons and hexagons with Part IV

It's pretty straightforward to unit test the components of an application that follows Hexagonal Architecture. The components are part of specific layers, and mocking the next dependency layer is usually simple. However, this approach means we never test the application as a whole and have to rely on expensive integration or end-to-end tests to do so.

We can test the application components in sociable manner, leaving our components' direct dependencies as-is, and pushing the mocks further to the application edges.

If we push the mocks too far, we end up with lightweight integration tests. Let's explore how we can utilise such tests in a context of Django application and what benefits we can reap.


Continue reading

Hexagonal architecture and Python - Part III: Persistence, Transactions, Exceptions and The Final Assembly

Posted on 31 December 2022 in Articles • Tagged with architecture, DDD, dependency injection, Django, hexagonal architecture, programming, python • 10 min read

Python logo in a hexagon with Roman III literal

Welcome to the third part of the article series, which cover principles of Hexagonal architecture, Dependency Injection, Domain-Driven Design and applies these all to Python and Django application design.


Continue reading

Hexagonal architecture and Python - Part II: Domain, Application Services, Ports and Adapters

Posted on 18 September 2022 in Articles • Tagged with architecture, DDD, dependency injection, hexagonal architecture, programming, python • 11 min read

Python logo in a hexagon with Roman II literal

Welcome to the second part of the article series, which cover principles of Hexagonal architecture, Dependency Injection, Domain-Driven Design and applies these all to Python and Django application design.


Continue reading

Hexagonal architecture and Python - Part I: Dependency Injection and componential architecture

Posted on 30 October 2021 in Articles • Tagged with architecture, DDD, dependency injection, hexagonal architecture, programming, python • 8 min read

Python logo in a hexagon

Welcome to articles series which cover the principles of Hexagonal architecture, talks of Dependency Injection, and its usage in these to Python and Django application design.


Continue reading