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

[SDESK-7441] Create basic async resource models and services for planning.events #2131

Merged
merged 16 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
8 changes: 4 additions & 4 deletions .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8']
python-version: ['3.10']
node-version: ['14']
e2e: ['a', 'b']
env:
Expand All @@ -17,11 +17,11 @@ jobs:
E2E: true
TZ: Australia/Sydney
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/ci-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ name: "CI-Server"
on: [push, pull_request]

jobs:
server-nose:
server-pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10']
env:
INSTALL_PY_MODULES: true
RUN_SERVICES: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -24,17 +24,18 @@ jobs:
run: ./scripts/ci-start-services.sh
- name: Pytest
run: pytest --log-level=ERROR --disable-warnings server/planning

server-behave:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10']
env:
INSTALL_PY_MODULES: true
RUN_SERVICES: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -51,14 +52,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10']
env:
INSTALL_PY_MODULES: true
INSTALL_PY_EDITABLE: true
RUN_SERVICES: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
2 changes: 1 addition & 1 deletion e2e/server/core-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gunicorn==22.0.0
honcho==1.0.1
git+https://github.com/superdesk/superdesk-core.git@develop#egg=superdesk-core
superdesk-core @ git+https://github.com/superdesk/superdesk-core.git@async
42 changes: 29 additions & 13 deletions server/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,57 @@
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

import asyncio
import logging

from os import path

from apps.prepopulate.app_populate import AppPopulateCommand
from superdesk.tests.environment import before_feature, before_step, after_scenario # noqa
from superdesk.tests.environment import before_feature, before_step, after_scenario # noqa
from superdesk.tests.environment import setup_before_all, setup_before_scenario
from app import get_app
from settings import INSTALLED_APPS


logger = logging.getLogger(__name__)


def before_all(context):
config = {
'INSTALLED_APPS': INSTALLED_APPS,
'ELASTICSEARCH_FORCE_REFRESH': True,
"INSTALLED_APPS": INSTALLED_APPS,
"ELASTICSEARCH_FORCE_REFRESH": True,
}
setup_before_all(context, config, app_factory=get_app)


def before_scenario(context, scenario):
try:
loop = asyncio.get_event_loop()
loop.run_until_complete(before_scenario_async(context, scenario))
except Exception as e:
# Make sure exceptions raised are printed to the console
logger.exception(e)
raise e


async def before_scenario_async(context, scenario):
config = {
'INSTALLED_APPS': INSTALLED_APPS,
'ELASTICSEARCH_FORCE_REFRESH': True,
"INSTALLED_APPS": INSTALLED_APPS,
"ELASTICSEARCH_FORCE_REFRESH": True,
}

if 'link_updates' in scenario.tags:
config['PLANNING_LINK_UPDATES_TO_COVERAGES'] = True
if "link_updates" in scenario.tags:
config["PLANNING_LINK_UPDATES_TO_COVERAGES"] = True
else:
config['PLANNING_LINK_UPDATES_TO_COVERAGES'] = False
config["PLANNING_LINK_UPDATES_TO_COVERAGES"] = False

if 'no_scheduled_updates' in scenario.tags:
config['PLANNING_ALLOW_SCHEDULED_UPDATES'] = False
if "no_scheduled_updates" in scenario.tags:
config["PLANNING_ALLOW_SCHEDULED_UPDATES"] = False

setup_before_scenario(context, scenario, config, app_factory=get_app)
await setup_before_scenario(context, scenario, config, app_factory=get_app)

if 'planning_cvs' in scenario.tags:
with context.app.app_context():
if "planning_cvs" in scenario.tags:
async with context.app.app_context():
cmd = AppPopulateCommand()
filename = path.join(path.abspath(path.dirname("features/steps/fixtures/")), "vocabularies.json")
cmd.run(filename)
Loading
Loading