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

fixtures: reana-db objects for session/engine #60

Merged
merged 2 commits into from
Apr 30, 2020

Conversation

diegodelemos
Copy link
Member

Closes #33.

diegodelemos pushed a commit to mvidalgarcia/reana-server that referenced this pull request Apr 29, 2020
@diegodelemos diegodelemos marked this pull request as ready for review April 30, 2020 08:15
@diegodelemos diegodelemos marked this pull request as ready for review April 30, 2020 08:51
diegodelemos pushed a commit to mvidalgarcia/reana-server that referenced this pull request Apr 30, 2020
* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).
mvidalgarcia added a commit to mvidalgarcia/reana-db that referenced this pull request Apr 30, 2020
- Prevent creating a new UserToken when granting token to a user
that had requested it (setter).
- UserToken token can be None, in fact it's None when is 'requested'.
- Adapt tests to reanahub/pytest-reana#60
@diegodelemos diegodelemos merged commit c3950f7 into reanahub:master Apr 30, 2020
mvidalgarcia added a commit to mvidalgarcia/reana-db that referenced this pull request Apr 30, 2020
- Prevent creating a new UserToken when granting token to a user
that had requested it (setter).
- UserToken token can be None, in fact it's None when is 'requested'.
- Adapt tests to reanahub/pytest-reana#60
mvidalgarcia added a commit to mvidalgarcia/reana-db that referenced this pull request Apr 30, 2020
- Prevent creating a new UserToken when granting token to a user
that had requested it (setter).
- UserToken token can be None, in fact it's None when is 'requested'.
- Adapt tests to reanahub/pytest-reana#60
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request Apr 30, 2020
Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>

tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request Apr 30, 2020
Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>

tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request Apr 30, 2020
tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).

Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request Apr 30, 2020
tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).

Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request May 1, 2020
tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).

Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request May 1, 2020
tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).

Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>
mvidalgarcia added a commit to mvidalgarcia/reana-db that referenced this pull request May 1, 2020
- Prevent creating a new UserToken when granting token to a user
that had requested it (setter).
- UserToken token can be None, in fact it's None when is 'requested'.
- Adapt tests to reanahub/pytest-reana#60
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request May 1, 2020
tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).

Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this pull request May 1, 2020
tests: provide correct config to test flask app

* Stops using `console_script` to define `reana-admin` commands
  as this was creating a new Flask application with its own db
  session, which makes testing difficult.

* Depends on reanahub/pytest-reana#60 which
  avoids duplicating the session object.

* REANA_SQLALCHEMY_DATABASE_URI is now defined in `run_tests.sh` because
  it needs to be setted before the Python modules are loaded, and this is
  because it is a module level defined variable (REANA-DB is not Flask
  aware, therefore we cannot dinamically change its value). This was not
  happening before because we had a duplicated session which would be
  created as pytest fixture with the Flask config
  `SQLALCHEMY_DATABASE_URI`, however this solution created more problems
  leading to inconsistencies in tests (double session).

Co-authored-by: Diego Rodriguez <diego.rodriguez@cern.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fixtures: session is not unique
2 participants