Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestPyQgsPostgresProvider.testGeneratedColumns is not idempotent #45414

Closed
2 tasks
strk opened this issue Oct 5, 2021 · 1 comment · Fixed by #45415
Closed
2 tasks

TestPyQgsPostgresProvider.testGeneratedColumns is not idempotent #45414

strk opened this issue Oct 5, 2021 · 1 comment · Fixed by #45415
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! testsuite Issue related to testsuite

Comments

@strk
Copy link
Contributor

strk commented Oct 5, 2021

What is the bug or the crash?

Running this twice:

python3 tests/src/python/test_provider_postgres.py TestPyQgsPostgresProvider.testGeneratedColumns

Will pass the first time but fail the second time.
I think tests should be idempotent instead

NOTE: the python3 call should be made after setting proper env variables as documented in tests/README

Steps to reproduce the issue

from the build tree:

export QGIS_PREFIX_PATH=output PYTHONPATH=output/python:$PYTHONPATH
python3 tests/src/python/test_provider_postgres.py  TestPyQgsPostgresProvider.testGeneratedColumns
python3 tests/src/python/test_provider_postgres.py  TestPyQgsPostgresProvider.testGeneratedColumns

Versions

current master

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@strk strk added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 5, 2021
@strk strk self-assigned this Oct 5, 2021
@strk
Copy link
Contributor Author

strk commented Oct 5, 2021

The error on second run is:

  Provider errors:
      PostGIS error while adding features: ERROR:  duplicate key value violates unique constraint "generated_columns_pkey"
    DETAIL:  Key (pk)=(2) already exists.
    
F
======================================================================
FAIL: testGeneratedColumns (__main__.TestPyQgsPostgresProvider)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/src/qgis/qgis/src/master/tests/src/python/providertestbase.py", line 1192, in testGeneratedColumns
    self.assertFalse(QgsVectorLayerUtils.fieldIsEditable(vl, 0, feature))
AssertionError: True is not false

----------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! testsuite Issue related to testsuite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant