Skip to content

Commit 5bb7e0c

Browse files
authored
Delete python tests (#353)
* Delete python tests * Rename utils
1 parent fe892d4 commit 5bb7e0c

File tree

14 files changed

+8
-788
lines changed

14 files changed

+8
-788
lines changed

docker/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ RUN apt-get install -qq \
2424
qt5-qmake \
2525
qtbase5-dev-tools \
2626
libqt5websockets5-dev\
27-
libclang-dev\
28-
python3-pip
27+
libclang-dev
2928

3029
# Install jcon-cpp library
3130
RUN git clone https://github.com/joncol/jcon-cpp.git /jcon-cpp && cd /jcon-cpp && git checkout 2235654e39c7af505d7158bf996e47e37a23d6e3 && mkdir build && cd build && cmake .. && make -j4 && make install
@@ -43,10 +42,6 @@ RUN mkdir /usr/bin/sdk/bpf/dependencies \
4342
USER pyth
4443
WORKDIR /home/pyth
4544

46-
# Install poetry
47-
RUN curl -sSL https://install.python-poetry.org | python3 -
48-
ENV PATH="${PATH}:/home/pyth/.local/bin:/home/pyth/pyth-client/build"
49-
5045
#Install rust
5146
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
5247
| sh -s -- -y
@@ -63,7 +58,6 @@ RUN ./pyth-client/scripts/patch-solana.sh
6358
# Build and test the oracle program.
6459
RUN cd pyth-client && ./scripts/build-bpf.sh .
6560
RUN cd pyth-client && ./scripts/check-size.sh
66-
RUN cd pyth-client/pyth && poetry install && poetry run python -m pytest
6761

6862
ENTRYPOINT []
6963
CMD []

program/rust/src/processor/upd_price.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use {
1010
},
1111
instruction::UpdPriceArgs,
1212
utils::{
13-
check_confidence_too_big,
1413
check_valid_funding_account,
1514
check_valid_writable_account,
15+
get_status_for_update,
1616
is_component_update,
1717
pyth_assert,
1818
try_convert,
@@ -146,7 +146,7 @@ pub fn upd_price(
146146
// Try to update the publisher's price
147147
if is_component_update(cmd_args)? {
148148
let status: u32 =
149-
check_confidence_too_big(cmd_args.price, cmd_args.confidence, cmd_args.status)?;
149+
get_status_for_update(cmd_args.price, cmd_args.confidence, cmd_args.status)?;
150150

151151
{
152152
let mut price_data =

program/rust/src/tests/test_publish_batch.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use {
1010
PythSimulator,
1111
Quote,
1212
},
13-
utils::check_confidence_too_big,
13+
utils::get_status_for_update,
1414
},
1515
solana_program::pubkey::Pubkey,
1616
solana_sdk::{
@@ -79,7 +79,7 @@ async fn test_publish_batch() {
7979
assert_eq!(price_data.comp_[0].latest_.conf_, quote.confidence);
8080
assert_eq!(
8181
price_data.comp_[0].latest_.status_,
82-
check_confidence_too_big(quote.price, quote.confidence, quote.status).unwrap()
82+
get_status_for_update(quote.price, quote.confidence, quote.status).unwrap()
8383
);
8484
assert_eq!(price_data.comp_[0].agg_.price_, 0);
8585
assert_eq!(price_data.comp_[0].agg_.conf_, 0);
@@ -115,14 +115,13 @@ async fn test_publish_batch() {
115115
assert_eq!(price_data.comp_[0].latest_.conf_, new_quote.confidence);
116116
assert_eq!(
117117
price_data.comp_[0].latest_.status_,
118-
check_confidence_too_big(new_quote.price, new_quote.confidence, new_quote.status)
119-
.unwrap()
118+
get_status_for_update(new_quote.price, new_quote.confidence, new_quote.status).unwrap()
120119
);
121120
assert_eq!(price_data.comp_[0].agg_.price_, quote.price);
122121
assert_eq!(price_data.comp_[0].agg_.conf_, quote.confidence);
123122
assert_eq!(
124123
price_data.comp_[0].agg_.status_,
125-
check_confidence_too_big(quote.price, quote.confidence, quote.status).unwrap()
124+
get_status_for_update(quote.price, quote.confidence, quote.status).unwrap()
126125
);
127126
}
128127
}

program/rust/src/utils.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,7 @@ pub fn is_component_update(cmd_args: &UpdPriceArgs) -> Result<bool, OracleError>
200200
}
201201

202202
// Return PC_STATUS_IGNORED if confidence is bigger than price divided by MAX_CI_DIVISOR else returns status
203-
pub fn check_confidence_too_big(
204-
price: i64,
205-
confidence: u64,
206-
status: u32,
207-
) -> Result<u32, OracleError> {
203+
pub fn get_status_for_update(price: i64, confidence: u64, status: u32) -> Result<u32, OracleError> {
208204
let mut threshold_conf = price / MAX_CI_DIVISOR;
209205

210206
if threshold_conf < 0 {

pyth/README.md

Whitespace-only changes.

pyth/poetry.lock

Lines changed: 0 additions & 226 deletions
This file was deleted.

pyth/pyproject.toml

Lines changed: 0 additions & 20 deletions
This file was deleted.

pyth/pyth/__init__.py

Whitespace-only changes.

pyth/tests/__init__.py

Whitespace-only changes.

pyth/tests/conftest.py

Lines changed: 0 additions & 277 deletions
This file was deleted.

0 commit comments

Comments
 (0)