Skip to content

Commit eede068

Browse files
committed
test cpp
1 parent 23fe524 commit eede068

File tree

4 files changed

+46
-47
lines changed

4 files changed

+46
-47
lines changed

Diff for: .devcontainer/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.224.3/containers/python-3/.devcontainer/base.Dockerfile
1616

1717
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
18-
ARG VARIANT="3.10-bullseye"
19-
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
18+
ARG VARIANT="3.12-bullseye"
19+
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
2020

2121
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
2222
ARG NODE_VERSION="18"
@@ -34,7 +34,7 @@ RUN pip3 install --upgrade pip && pip3 --disable-pip-version-check --no-cache-di
3434
# [Optional] Uncomment this line to install global node packages.
3535
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
3636

37-
RUN apt-get update && apt-get install -y ruby && gem install license_finder -v 7.1.0 && gembin=`(gem env | sed -n "s/.*EXECUTABLE DIRECTORY: \(.*\)/\1/p")` && export PATH=$gembin:$PATH
37+
RUN apt-get update && apt-get install -y ruby && gem install license_finder && gembin=`(gem env | sed -n "s/.*EXECUTABLE DIRECTORY: \(.*\)/\1/p")` && export PATH=$gembin:$PATH
3838

3939
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y
4040

Diff for: .devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
2323
// Append -bullseye or -buster to pin to an OS version.
2424
// Use -bullseye variants on local on arm64/Apple Silicon.
25-
"VARIANT": "3.10",
25+
"VARIANT": "3.12",
2626
// Options
2727
"NODE_VERSION": "lts/*"
2828
}

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
pip install pytest pytest-cov
6060
su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install lts/* 2>&1"
6161
apt-get update && apt-get install -y ruby
62-
gem install license_finder -v 7.1.0 && gembin=`(gem env | sed -n "s/.*EXECUTABLE DIRECTORY: \(.*\)/\1/p")`
62+
gem install license_finder && gembin=`(gem env | sed -n "s/.*EXECUTABLE DIRECTORY: \(.*\)/\1/p")`
6363
export PATH=$gembin:$PATH
6464
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y
6565

Diff for: test/test_licensevalidator.py

+41-42
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
"""Integration tests for license validator."""
1616

17-
1817
from licensevalidator.licensevalidator import validate_used_licenses
1918

2019

@@ -98,56 +97,56 @@ def test_javascript():
9897
assert origin_vs_deps["JavaScript"][1].version == "4.6.3"
9998

10099

101-
# def test_cpp():
102-
# """Test cpp project."""
103-
# result, origin_vs_deps = validate_used_licenses(
104-
# "./testbench/multilang/cpp-proj",
105-
# [{"path": ".", "cpp-conan-included-profile-files": ["./conan_profile"]}],
106-
# "../whitelist.txt",
107-
# )
100+
def test_cpp():
101+
"""Test cpp project."""
102+
result, origin_vs_deps = validate_used_licenses(
103+
"./testbench/multilang/cpp-proj",
104+
[{"path": ".", "cpp-conan-included-profile-files": ["./conan_profile"]}],
105+
"../whitelist.txt",
106+
)
108107

109-
# assert result
110-
# assert len(origin_vs_deps) == 1
111-
# assert "c++" in origin_vs_deps
108+
assert result
109+
assert len(origin_vs_deps) == 1
110+
assert "c++" in origin_vs_deps
112111

113-
# index = 0
114-
# assert origin_vs_deps["c++"][index].name == "abseil"
112+
index = 0
113+
assert origin_vs_deps["c++"][index].name == "abseil"
115114

116-
# index += 1
117-
# assert origin_vs_deps["c++"][index].name == "c-ares"
115+
index += 1
116+
assert origin_vs_deps["c++"][index].name == "c-ares"
118117

119-
# index += 1
120-
# assert origin_vs_deps["c++"][index].name == "grpc"
118+
index += 1
119+
assert origin_vs_deps["c++"][index].name == "grpc"
121120

122-
# index += 1
123-
# assert origin_vs_deps["c++"][index].name == "gtest"
121+
index += 1
122+
assert origin_vs_deps["c++"][index].name == "gtest"
124123

125-
# index += 1
126-
# assert origin_vs_deps["c++"][index].name == "openssl"
124+
index += 1
125+
assert origin_vs_deps["c++"][index].name == "openssl"
127126

128-
# index += 1
129-
# assert origin_vs_deps["c++"][index].name == "protobuf"
127+
index += 1
128+
assert origin_vs_deps["c++"][index].name == "protobuf"
130129

131-
# index += 1
132-
# assert origin_vs_deps["c++"][index].name == "re2"
130+
index += 1
131+
assert origin_vs_deps["c++"][index].name == "re2"
133132

134-
# index += 1
135-
# assert origin_vs_deps["c++"][index].name == "zlib"
133+
index += 1
134+
assert origin_vs_deps["c++"][index].name == "zlib"
136135

137136

138-
# def test_multilang():
139-
# result, origin_vs_deps = validate_used_licenses(
140-
# "./testbench/multilang",
141-
# [
142-
# {"path": "cpp-proj", "cpp-conan-included-profile-files": ["conan_profile"]},
143-
# {"path": "rust-proj"},
144-
# {"path": "python-proj"},
145-
# ],
146-
# "whitelist.txt",
147-
# )
137+
def test_multilang():
138+
result, origin_vs_deps = validate_used_licenses(
139+
"./testbench/multilang",
140+
[
141+
{"path": "cpp-proj", "cpp-conan-included-profile-files": ["conan_profile"]},
142+
{"path": "rust-proj"},
143+
{"path": "python-proj"},
144+
],
145+
"whitelist.txt",
146+
)
148147

149-
# assert result is False
150-
# assert len(origin_vs_deps) == 3
151-
# assert "c++" in origin_vs_deps
152-
# assert "Rust" in origin_vs_deps
153-
# assert "Python" in origin_vs_deps
148+
assert result is False
149+
assert len(origin_vs_deps) == 3
150+
assert "c++" in origin_vs_deps
151+
assert "Rust" in origin_vs_deps
152+
assert "Python" in origin_vs_deps

0 commit comments

Comments
 (0)