Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3d1e48d
remove egypt from eu countries list
mostafa-hisham Dec 11, 2025
f45ef1d
add new countries registries
mostafa-hisham Dec 11, 2025
8b3adc7
init new registries and Skip vat_num format validation for countries …
mostafa-hisham Dec 11, 2025
9696462
add vat_rules for new countries
mostafa-hisham Dec 11, 2025
1cb9f87
add test for new countries
mostafa-hisham Dec 11, 2025
0dcd614
refactor old tests to work with our edits
mostafa-hisham Dec 11, 2025
12ad19a
update readme
mostafa-hisham Dec 11, 2025
ca9ce85
add tests ci
mostafa-hisham Dec 11, 2025
d631d34
workflow on forks
mostafa-hisham Dec 11, 2025
7df0c08
fix workflow branch
mostafa-hisham Dec 11, 2025
c9d6052
chnage class name
mostafa-hisham Dec 11, 2025
106b503
Norway B2B not exempt
mostafa-hisham Dec 11, 2025
900a182
treat monaco and france regions like france but with different vat rates
mostafa-hisham Dec 11, 2025
662a6a7
rename classses
mostafa-hisham Dec 12, 2025
95f3550
add regex to Frech countries
mostafa-hisham Dec 12, 2025
acb0fdb
create and use global FRANCE_COUNTRY_CODES
mostafa-hisham Dec 12, 2025
aa85a94
create and use NON_EU_COUNTRY_CODES
mostafa-hisham Dec 12, 2025
81e7ba7
add new test that checks VAT% for noneu countries
mostafa-hisham Dec 12, 2025
2cd45ca
fix date condition
mostafa-hisham Dec 12, 2025
3718f20
simplfiy conditon
mostafa-hisham Dec 12, 2025
370809d
codition explaination
mostafa-hisham Dec 12, 2025
35f537e
Update pyvat/vat_rules.py
mostafa-hisham Dec 12, 2025
2ce4ef7
rename class
mostafa-hisham Dec 12, 2025
26c8bd5
fix codition
mostafa-hisham Dec 12, 2025
1cdf199
update readme
mostafa-hisham Dec 12, 2025
9d2431b
remove line
mostafa-hisham Dec 12, 2025
4601aa6
fix imports, workflow and typo
mostafa-hisham Dec 12, 2025
6f53399
fix confilect
mostafa-hisham Dec 12, 2025
084ced6
Franc monaco and dom
mostafa-hisham Dec 15, 2025
4035704
Fix test
mostafa-hisham Dec 15, 2025
6aadd1a
create doc with vat rates for frnace as seller of digital goods
mostafa-hisham Dec 15, 2025
edcc349
Rename FRANCE_VAT_RATES_DIGITAL_GOODS.md to docs/FRANCE_VAT_RATES_DIG…
nicomollet Dec 15, 2025
bae70a3
handle Great Britain
mostafa-hisham Dec 15, 2025
528f133
Merge branch 'enhancement/11-move-vat-rates' of github.com:wp-media/p…
mostafa-hisham Dec 15, 2025
5373fd5
EG 14 b2b/b2c and add FR test
mostafa-hisham Dec 15, 2025
682258f
Update tests/test_new_countries.py
mostafa-hisham Dec 15, 2025
7013fda
Update tests/test_new_countries.py
mostafa-hisham Dec 15, 2025
5f7f3bd
Update tests/test_validators.py
mostafa-hisham Dec 15, 2025
3fb7220
Update README.rst
mostafa-hisham Dec 15, 2025
bf3947a
Update tests/test_new_countries.py
mostafa-hisham Dec 15, 2025
eef3a89
EG b2b 0 vat rate
mostafa-hisham Dec 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run Tests

on:
pull_request:
branches:
- master
push:
branches:
- master

permissions:
contents: read
pull-requests: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest

- name: Run tests
run: |
python -m pytest tests/ -v

65 changes: 65 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,68 @@ Usage


For more detailed documentation, see the `full pyvat documentation <http://pyvat.readthedocs.org/>`_.


Running Tests
-------------

``pyvat`` uses `pytest <https://pytest.org/>`_ for testing. To run the test suite:

**Install test dependencies:**

.. code-block:: bash

$ pip install pytest

**Run all tests:**

.. code-block:: bash

$ python -m pytest tests/ -v

**Run specific test files:**

.. code-block:: bash

# Test new countries implementation
$ python -m pytest tests/test_new_countries.py -v

# Test VAT charge calculations
$ python -m pytest tests/test_sale_vat_charge.py -v

# Test VAT number validators
$ python -m pytest tests/test_validators.py -v

**Run with coverage:**

.. code-block:: bash

$ pip install pytest-cov
$ python -m pytest tests/ --cov=pyvat --cov-report=html

**Test Results:**

The test suite includes:

* **VAT Rules Tests**: Verify correct VAT rates for all supported countries
* **Registry Tests**: Test B2B exemption logic for different countries
* **VAT Charge Tests**: Ensure proper VAT calculation for cross-border sales
* **Validator Tests**: Check VAT number format validation

*Note: Some validator tests that call external VIES API are currently skipped and will be refactored with mocks.*


Supported Countries
-------------------

**EU Countries**: All EU member states with full VIES integration

**Special VAT Territories**:

* **French DOM Territories** (RE, GP, MQ) - 8.5% VAT, outside EU VAT territory
* **France & Monaco** (FR, MC) - Same VAT territory, 20% standard rate
* **Non-EU Countries** (EG, CH, CA, NO) - Special VAT arrangements

For detailed VAT rates, calculations, and examples for digital goods sold from France, see `FRANCE_VAT_RATES_DIGITAL_GOODS.md <docs/FRANCE_VAT_RATES_DIGITAL_GOODS.md>`_.


Loading