Repository navigation
Description
Describe the bug
The gauge init project fails to run within a VSCode devcontainer.
To Reproduce
Steps (or project) to reproduce the behavior:
- Ensure Docker is installed
- Initialize a new gauge project
- Open this project folder in VSCode
- Ensure VSCode's Remote - Containers extension,
ms-vscode-remote.remote-containers, is installed locally - Copy the below
devcontainer.jsonandDockerfileinto a new folder at the project root named.devcontainer - Use the VSCode gauge extension to run the newly initialized project specification
- It should run successfully
- Open the command palette and select
Remote-Containers: reopen in container - Wait for docker image to build, say yes to any requests to install recommended extensions inside the container
- Re-run the gauge test using the vscode extension
- Note that the step implementations are not found
devcontainer.json
{
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
"VARIANT": "3",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"getgauge.gauge"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}Dockerfile
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
ARG VARIANT="3"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
# [Option] Install Node.js
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
COPY requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
&& rm -rf /tmp/pip-tmp
# Add Gauge's GPG key
RUN sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-keys 023EDB0B
# Add Gauge to the repository list
RUN echo deb https://dl.bintray.com/gauge/gauge-deb stable main | sudo tee -a /etc/apt/sources.list
# Install Gauge apt package
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends gauge
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1Logs
Localhost
Running tool: gauge run --simple-console --hide-suggestion
Python: 3.8.5
# Specification Heading
## Vowel counts in single word
## Vowel counts in multiple word
Successfully generated html-report to => /Users/znorris/src/git.scorevision.com/znorris/gauge_devcontainer/reports/html-report/index.html
Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 2 executed 2 passed 0 failed 0 skipped
Total time taken: 69ms
Success: Tests passed.
Devcontainer
Running tool: gauge run --simple-console --hide-suggestion
Compatible version of plugin html-report not found. Installing plugin html-report...
........................
Successfully installed plugin 'html-report' version 4.0.12
Installing required plugins.
........................
Successfully installed plugin 'screenshot' version 0.0.1
Python: 3.9.1
[ValidationError] /workspaces/gauge_devcontainer/specs/example.spec:11 Step implementation not found => 'Vowels in English language are "aeiou".'
[ValidationError] /workspaces/gauge_devcontainer/specs/example.spec:17 Step implementation not found => 'The word "gauge" has "3" vowels.'
[ValidationError] /workspaces/gauge_devcontainer/specs/example.spec:26 Step implementation not found => 'Almost all words have vowels <table>'
Successfully generated html-report to => /workspaces/gauge_devcontainer/reports/html-report/index.html
Specifications: 0 executed 0 passed 0 failed 1 skipped
Scenarios: 0 executed 0 passed 0 failed 2 skipped
Total time taken: 66ms
Success: Tests passed.
Expected behavior
Gauge should find the python implementation even in a container.
Screenshots
If applicable, add screenshots to help explain your problem.
Versions:
Localhost
VSCode:
Version: 1.52.0
Commit: 940b5f4bb5fa47866a54529ed759d95d09ee80be
Date: 2020-12-10T22:46:53.673Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 20.1.0
VSCode extension: v0.0.17
% gauge -v
Gauge version: 1.1.6
Plugins
-------
html-report (4.0.12)
python (0.3.12)
screenshot (0.0.1)
Devcontainer
VSCode extension: v0.0.17
$ gauge -v
Gauge version: 1.1.6
Commit Hash: 3af456f
Plugins
-------
html-report (4.0.12)
python (0.3.12)
screenshot (0.0.1)
Additional context
Using devcontainers will allow me to quickly bring my entire team up to speed on Gauge without asking much of their local development environments.
Activity
bugdiver commentedon Dec 15, 2020
@znorris Thanks for creating the detailed issue. I did some investigation and seems like the problem is happening cause of the Python version. The library used to parse the python implementation files is not working properly for the Python version (3.9.3).
We are looking into the issue, meanwhile, you can try a workaround by adding
GETGAUGE_USE_0_3_3_PARSER = truein theenv/default/python.propertiesfile. This will make the python plugin to use an alternate library for parsing.znorris commentedon Dec 15, 2020
@bugdiver Thank you for taking the time to replicate my issue. Your work around was just what I needed! I can't wait to get this out to the rest of the team. 👍
bugdiver commentedon Dec 28, 2020
@znorris A new version of the python p[lugin has been released. Could you verify if it works seamlessly (without using
GETGAUGE_USE_0_3_3_PARSER = true)?znorris commentedon Dec 28, 2020
Everything looks good to me. They don't call you @bugdiver for nothing, thank you!