Skip to content

Commit

Permalink
Add check for pt_PT in test_locale (#841)
Browse files Browse the repository at this point in the history
* Add check for locale

* Update CHANGELOG

* Wording and spacing

* Update integration-test.yml

---------

Co-authored-by: Mohammed Ghannam <ghannam@zib.de>
  • Loading branch information
Joao-Dionisio and mmghannam committed Apr 7, 2024
1 parent 6a17c96 commit 32caac7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ jobs:
wget --quiet --no-check-certificate https://github.com/scipopt/scip/releases/download/$(echo "v${{env.version}}" | tr -d '.')/SCIPOptSuite-${{ env.version }}-Linux-ubuntu20.deb
sudo apt-get update && sudo apt install -y ./SCIPOptSuite-${{ env.version }}-Linux-ubuntu20.deb
- name: Install locales for tests
run: sudo apt-get install tzdata locales -y && sudo locale-gen pt_PT && sudo update-locale # add pt_PT locale that is used in tests

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
### Added
- Added check for pt_PT locale in test_model.py
### Fixed
### Changed
### Removed
Expand Down
15 changes: 9 additions & 6 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,18 @@ def test_locale():
import locale

m = Model()
x = m.addVar(lb=1.1)

locale.setlocale(locale.LC_NUMERIC, "pt_PT")

m.addVar(lb=1.1)

try:
locale.setlocale(locale.LC_NUMERIC, "pt_PT")
except Exception:
pytest.skip("pt_PT locale was not found. It might need to be installed.")

assert locale.str(1.1) == "1,1"

m.writeProblem("model.cip")

with open("model.cip") as file:
assert "1,1" not in file.read()

locale.setlocale(locale.LC_NUMERIC,"")
locale.setlocale(locale.LC_NUMERIC,"")

0 comments on commit 32caac7

Please sign in to comment.