Skip to content

Commit 32caac7

Browse files
Add check for pt_PT in test_locale (#841)
* Add check for locale * Update CHANGELOG * Wording and spacing * Update integration-test.yml --------- Co-authored-by: Mohammed Ghannam <[email protected]>
1 parent 6a17c96 commit 32caac7

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.github/workflows/integration-test.yml

-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
wget --quiet --no-check-certificate https://github.com/scipopt/scip/releases/download/$(echo "v${{env.version}}" | tr -d '.')/SCIPOptSuite-${{ env.version }}-Linux-ubuntu20.deb
2626
sudo apt-get update && sudo apt install -y ./SCIPOptSuite-${{ env.version }}-Linux-ubuntu20.deb
2727
28-
- name: Install locales for tests
29-
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
30-
3128
- name: Setup python ${{ matrix.python-version }}
3229
uses: actions/setup-python@v4
3330
with:

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44
### Added
5+
- Added check for pt_PT locale in test_model.py
56
### Fixed
67
### Changed
78
### Removed

tests/test_model.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,18 @@ def test_locale():
347347
import locale
348348

349349
m = Model()
350-
x = m.addVar(lb=1.1)
351-
352-
locale.setlocale(locale.LC_NUMERIC, "pt_PT")
353-
350+
m.addVar(lb=1.1)
351+
352+
try:
353+
locale.setlocale(locale.LC_NUMERIC, "pt_PT")
354+
except Exception:
355+
pytest.skip("pt_PT locale was not found. It might need to be installed.")
356+
354357
assert locale.str(1.1) == "1,1"
355-
358+
356359
m.writeProblem("model.cip")
357360

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

361-
locale.setlocale(locale.LC_NUMERIC,"")
364+
locale.setlocale(locale.LC_NUMERIC,"")

0 commit comments

Comments
 (0)