version: '3'
services:
  python_environment:
    image: python:3
    depends_on:
     - emulator
    volumes:
     - .:/code
    working_dir: /code
    environment:
     - PYTHONPATH=/code
     - PYTHONUNBUFFERED=0
    command: sh -c "pip install -r requirements.txt;py.test test -s -v --junit-xml test_result.xml;pip install 'aiofiles>=0.4.0';py.test test_async -s -v --junit-xml test_result_async.xml"

  emulator:
    image: swind/android-emulator:android_28
    environment:
     - ANDROID_AVD_EXTRA_ARGS=--device 8 --force
     - ANDROID_EMULATOR_EXTRA_ARGS=-skin 1080x1920 -memory 2048 -no-boot-anim -gpu host -qemu
    ports:
      - 6080:6080
    devices:
      - "/dev/kvm:/dev/kvm"
