From 94faa7f301da30dbe8a4754070e8ffaea6455f26 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 3 Sep 2022 11:49:03 -0400 Subject: [PATCH] Rename resources/test/src to resources/test/fixtures (#92) --- README.md | 2 +- resources/test/{src => fixtures}/E501.py | 0 resources/test/{src => fixtures}/F401.py | 0 resources/test/{src => fixtures}/F403.py | 0 resources/test/{src => fixtures}/F541.py | 0 resources/test/{src => fixtures}/F634.py | 0 resources/test/{src => fixtures}/F704.py | 0 resources/test/{src => fixtures}/F706.py | 0 resources/test/{src => fixtures}/F821.py | 0 resources/test/{src => fixtures}/F823.py | 0 resources/test/{src => fixtures}/F831.py | 0 resources/test/{src => fixtures}/F841.py | 0 resources/test/{src => fixtures}/F901.py | 0 resources/test/{src => fixtures}/R0205.py | 0 resources/test/{src => fixtures}/__init__.py | 0 .../test/{src => fixtures}/bar/__init__.py | 0 .../bar/migrations/__init__.py | 0 .../bar/migrations/migration.py | 0 resources/test/{src => fixtures}/excluded.py | 0 .../test/{src => fixtures}/foo/__init__.py | 0 .../foo/migrations/__init__.py | 0 .../foo/migrations/migration.py | 0 .../test/{src => fixtures}/pyproject.toml | 0 src/linter.rs | 88 +++++++++---------- src/pyproject.rs | 6 +- 25 files changed, 48 insertions(+), 48 deletions(-) rename resources/test/{src => fixtures}/E501.py (100%) rename resources/test/{src => fixtures}/F401.py (100%) rename resources/test/{src => fixtures}/F403.py (100%) rename resources/test/{src => fixtures}/F541.py (100%) rename resources/test/{src => fixtures}/F634.py (100%) rename resources/test/{src => fixtures}/F704.py (100%) rename resources/test/{src => fixtures}/F706.py (100%) rename resources/test/{src => fixtures}/F821.py (100%) rename resources/test/{src => fixtures}/F823.py (100%) rename resources/test/{src => fixtures}/F831.py (100%) rename resources/test/{src => fixtures}/F841.py (100%) rename resources/test/{src => fixtures}/F901.py (100%) rename resources/test/{src => fixtures}/R0205.py (100%) rename resources/test/{src => fixtures}/__init__.py (100%) rename resources/test/{src => fixtures}/bar/__init__.py (100%) rename resources/test/{src => fixtures}/bar/migrations/__init__.py (100%) rename resources/test/{src => fixtures}/bar/migrations/migration.py (100%) rename resources/test/{src => fixtures}/excluded.py (100%) rename resources/test/{src => fixtures}/foo/__init__.py (100%) rename resources/test/{src => fixtures}/foo/migrations/__init__.py (100%) rename resources/test/{src => fixtures}/foo/migrations/migration.py (100%) rename resources/test/{src => fixtures}/pyproject.toml (100%) diff --git a/README.md b/README.md index 765f082220..327ba93cd2 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ for development. Assuming you have `cargo` installed, you can run: ```shell -cargo run resources/test/src +cargo run resources/test/fixtures cargo fmt cargo clippy cargo test diff --git a/resources/test/src/E501.py b/resources/test/fixtures/E501.py similarity index 100% rename from resources/test/src/E501.py rename to resources/test/fixtures/E501.py diff --git a/resources/test/src/F401.py b/resources/test/fixtures/F401.py similarity index 100% rename from resources/test/src/F401.py rename to resources/test/fixtures/F401.py diff --git a/resources/test/src/F403.py b/resources/test/fixtures/F403.py similarity index 100% rename from resources/test/src/F403.py rename to resources/test/fixtures/F403.py diff --git a/resources/test/src/F541.py b/resources/test/fixtures/F541.py similarity index 100% rename from resources/test/src/F541.py rename to resources/test/fixtures/F541.py diff --git a/resources/test/src/F634.py b/resources/test/fixtures/F634.py similarity index 100% rename from resources/test/src/F634.py rename to resources/test/fixtures/F634.py diff --git a/resources/test/src/F704.py b/resources/test/fixtures/F704.py similarity index 100% rename from resources/test/src/F704.py rename to resources/test/fixtures/F704.py diff --git a/resources/test/src/F706.py b/resources/test/fixtures/F706.py similarity index 100% rename from resources/test/src/F706.py rename to resources/test/fixtures/F706.py diff --git a/resources/test/src/F821.py b/resources/test/fixtures/F821.py similarity index 100% rename from resources/test/src/F821.py rename to resources/test/fixtures/F821.py diff --git a/resources/test/src/F823.py b/resources/test/fixtures/F823.py similarity index 100% rename from resources/test/src/F823.py rename to resources/test/fixtures/F823.py diff --git a/resources/test/src/F831.py b/resources/test/fixtures/F831.py similarity index 100% rename from resources/test/src/F831.py rename to resources/test/fixtures/F831.py diff --git a/resources/test/src/F841.py b/resources/test/fixtures/F841.py similarity index 100% rename from resources/test/src/F841.py rename to resources/test/fixtures/F841.py diff --git a/resources/test/src/F901.py b/resources/test/fixtures/F901.py similarity index 100% rename from resources/test/src/F901.py rename to resources/test/fixtures/F901.py diff --git a/resources/test/src/R0205.py b/resources/test/fixtures/R0205.py similarity index 100% rename from resources/test/src/R0205.py rename to resources/test/fixtures/R0205.py diff --git a/resources/test/src/__init__.py b/resources/test/fixtures/__init__.py similarity index 100% rename from resources/test/src/__init__.py rename to resources/test/fixtures/__init__.py diff --git a/resources/test/src/bar/__init__.py b/resources/test/fixtures/bar/__init__.py similarity index 100% rename from resources/test/src/bar/__init__.py rename to resources/test/fixtures/bar/__init__.py diff --git a/resources/test/src/bar/migrations/__init__.py b/resources/test/fixtures/bar/migrations/__init__.py similarity index 100% rename from resources/test/src/bar/migrations/__init__.py rename to resources/test/fixtures/bar/migrations/__init__.py diff --git a/resources/test/src/bar/migrations/migration.py b/resources/test/fixtures/bar/migrations/migration.py similarity index 100% rename from resources/test/src/bar/migrations/migration.py rename to resources/test/fixtures/bar/migrations/migration.py diff --git a/resources/test/src/excluded.py b/resources/test/fixtures/excluded.py similarity index 100% rename from resources/test/src/excluded.py rename to resources/test/fixtures/excluded.py diff --git a/resources/test/src/foo/__init__.py b/resources/test/fixtures/foo/__init__.py similarity index 100% rename from resources/test/src/foo/__init__.py rename to resources/test/fixtures/foo/__init__.py diff --git a/resources/test/src/foo/migrations/__init__.py b/resources/test/fixtures/foo/migrations/__init__.py similarity index 100% rename from resources/test/src/foo/migrations/__init__.py rename to resources/test/fixtures/foo/migrations/__init__.py diff --git a/resources/test/src/foo/migrations/migration.py b/resources/test/fixtures/foo/migrations/migration.py similarity index 100% rename from resources/test/src/foo/migrations/migration.py rename to resources/test/fixtures/foo/migrations/migration.py diff --git a/resources/test/src/pyproject.toml b/resources/test/fixtures/pyproject.toml similarity index 100% rename from resources/test/src/pyproject.toml rename to resources/test/fixtures/pyproject.toml diff --git a/src/linter.rs b/src/linter.rs index b3070c97b8..63be1d0fea 100644 --- a/src/linter.rs +++ b/src/linter.rs @@ -68,7 +68,7 @@ mod tests { #[test] fn e501() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/E501.py"), + Path::new("./resources/test/fixtures/E501.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -79,7 +79,7 @@ mod tests { let expected = vec![Message { kind: CheckKind::LineTooLong, location: Location::new(5, 89), - filename: "./resources/test/src/E501.py".to_string(), + filename: "./resources/test/fixtures/E501.py".to_string(), }]; assert_eq!(actual.len(), expected.len()); for i in 0..actual.len() { @@ -92,7 +92,7 @@ mod tests { #[test] fn f401() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F401.py"), + Path::new("./resources/test/fixtures/F401.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -104,17 +104,17 @@ mod tests { Message { kind: CheckKind::UnusedImport("logging.handlers".to_string()), location: Location::new(12, 1), - filename: "./resources/test/src/F401.py".to_string(), + filename: "./resources/test/fixtures/F401.py".to_string(), }, Message { kind: CheckKind::UnusedImport("functools".to_string()), location: Location::new(3, 1), - filename: "./resources/test/src/F401.py".to_string(), + filename: "./resources/test/fixtures/F401.py".to_string(), }, Message { kind: CheckKind::UnusedImport("collections.OrderedDict".to_string()), location: Location::new(4, 1), - filename: "./resources/test/src/F401.py".to_string(), + filename: "./resources/test/fixtures/F401.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -128,7 +128,7 @@ mod tests { #[test] fn f403() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F403.py"), + Path::new("./resources/test/fixtures/F403.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -140,12 +140,12 @@ mod tests { Message { kind: CheckKind::ImportStarUsage, location: Location::new(1, 1), - filename: "./resources/test/src/F403.py".to_string(), + filename: "./resources/test/fixtures/F403.py".to_string(), }, Message { kind: CheckKind::ImportStarUsage, location: Location::new(2, 1), - filename: "./resources/test/src/F403.py".to_string(), + filename: "./resources/test/fixtures/F403.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -158,7 +158,7 @@ mod tests { #[test] fn f541() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F541.py"), + Path::new("./resources/test/fixtures/F541.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -170,17 +170,17 @@ mod tests { Message { kind: CheckKind::FStringMissingPlaceholders, location: Location::new(4, 7), - filename: "./resources/test/src/F541.py".to_string(), + filename: "./resources/test/fixtures/F541.py".to_string(), }, Message { kind: CheckKind::FStringMissingPlaceholders, location: Location::new(5, 7), - filename: "./resources/test/src/F541.py".to_string(), + filename: "./resources/test/fixtures/F541.py".to_string(), }, Message { kind: CheckKind::FStringMissingPlaceholders, location: Location::new(7, 7), - filename: "./resources/test/src/F541.py".to_string(), + filename: "./resources/test/fixtures/F541.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -194,7 +194,7 @@ mod tests { #[test] fn f634() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F634.py"), + Path::new("./resources/test/fixtures/F634.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -206,12 +206,12 @@ mod tests { Message { kind: CheckKind::IfTuple, location: Location::new(1, 1), - filename: "./resources/test/src/F634.py".to_string(), + filename: "./resources/test/fixtures/F634.py".to_string(), }, Message { kind: CheckKind::IfTuple, location: Location::new(7, 5), - filename: "./resources/test/src/F634.py".to_string(), + filename: "./resources/test/fixtures/F634.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -225,7 +225,7 @@ mod tests { #[test] fn f704() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F704.py"), + Path::new("./resources/test/fixtures/F704.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -237,17 +237,17 @@ mod tests { Message { kind: CheckKind::YieldOutsideFunction, location: Location::new(6, 5), - filename: "./resources/test/src/F704.py".to_string(), + filename: "./resources/test/fixtures/F704.py".to_string(), }, Message { kind: CheckKind::YieldOutsideFunction, location: Location::new(9, 1), - filename: "./resources/test/src/F704.py".to_string(), + filename: "./resources/test/fixtures/F704.py".to_string(), }, Message { kind: CheckKind::YieldOutsideFunction, location: Location::new(10, 1), - filename: "./resources/test/src/F704.py".to_string(), + filename: "./resources/test/fixtures/F704.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -261,7 +261,7 @@ mod tests { #[test] fn f706() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F706.py"), + Path::new("./resources/test/fixtures/F706.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -273,12 +273,12 @@ mod tests { Message { kind: CheckKind::ReturnOutsideFunction, location: Location::new(6, 5), - filename: "./resources/test/src/F706.py".to_string(), + filename: "./resources/test/fixtures/F706.py".to_string(), }, Message { kind: CheckKind::ReturnOutsideFunction, location: Location::new(9, 1), - filename: "./resources/test/src/F706.py".to_string(), + filename: "./resources/test/fixtures/F706.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -292,7 +292,7 @@ mod tests { #[test] fn f821() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F821.py"), + Path::new("./resources/test/fixtures/F821.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -304,22 +304,22 @@ mod tests { Message { kind: CheckKind::UndefinedName("self".to_string()), location: Location::new(2, 12), - filename: "./resources/test/src/F821.py".to_string(), + filename: "./resources/test/fixtures/F821.py".to_string(), }, Message { kind: CheckKind::UndefinedName("self".to_string()), location: Location::new(6, 13), - filename: "./resources/test/src/F821.py".to_string(), + filename: "./resources/test/fixtures/F821.py".to_string(), }, Message { kind: CheckKind::UndefinedName("self".to_string()), location: Location::new(10, 9), - filename: "./resources/test/src/F821.py".to_string(), + filename: "./resources/test/fixtures/F821.py".to_string(), }, Message { kind: CheckKind::UndefinedName("numeric_string".to_string()), location: Location::new(21, 12), - filename: "./resources/test/src/F821.py".to_string(), + filename: "./resources/test/fixtures/F821.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -333,7 +333,7 @@ mod tests { #[test] fn f831() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F831.py"), + Path::new("./resources/test/fixtures/F831.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -345,17 +345,17 @@ mod tests { Message { kind: CheckKind::DuplicateArgumentName, location: Location::new(1, 25), - filename: "./resources/test/src/F831.py".to_string(), + filename: "./resources/test/fixtures/F831.py".to_string(), }, Message { kind: CheckKind::DuplicateArgumentName, location: Location::new(5, 28), - filename: "./resources/test/src/F831.py".to_string(), + filename: "./resources/test/fixtures/F831.py".to_string(), }, Message { kind: CheckKind::DuplicateArgumentName, location: Location::new(9, 27), - filename: "./resources/test/src/F831.py".to_string(), + filename: "./resources/test/fixtures/F831.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -369,7 +369,7 @@ mod tests { #[test] fn f823() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F823.py"), + Path::new("./resources/test/fixtures/F823.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -380,7 +380,7 @@ mod tests { let expected = vec![Message { kind: CheckKind::UndefinedLocal("my_var".to_string()), location: Location::new(6, 5), - filename: "./resources/test/src/F823.py".to_string(), + filename: "./resources/test/fixtures/F823.py".to_string(), }]; assert_eq!(actual.len(), expected.len()); for i in 0..actual.len() { @@ -393,7 +393,7 @@ mod tests { #[test] fn f841() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F841.py"), + Path::new("./resources/test/fixtures/F841.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -405,12 +405,12 @@ mod tests { Message { kind: CheckKind::UnusedVariable("e".to_string()), location: Location::new(3, 1), - filename: "./resources/test/src/F841.py".to_string(), + filename: "./resources/test/fixtures/F841.py".to_string(), }, Message { kind: CheckKind::UnusedVariable("z".to_string()), location: Location::new(16, 5), - filename: "./resources/test/src/F841.py".to_string(), + filename: "./resources/test/fixtures/F841.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -424,7 +424,7 @@ mod tests { #[test] fn f901() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/F901.py"), + Path::new("./resources/test/fixtures/F901.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -436,12 +436,12 @@ mod tests { Message { kind: CheckKind::RaiseNotImplemented, location: Location::new(2, 5), - filename: "./resources/test/src/F901.py".to_string(), + filename: "./resources/test/fixtures/F901.py".to_string(), }, Message { kind: CheckKind::RaiseNotImplemented, location: Location::new(6, 5), - filename: "./resources/test/src/F901.py".to_string(), + filename: "./resources/test/fixtures/F901.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); @@ -455,7 +455,7 @@ mod tests { #[test] fn r0205() -> Result<()> { let actual = check_path( - Path::new("./resources/test/src/R0205.py"), + Path::new("./resources/test/fixtures/R0205.py"), &settings::Settings { line_length: 88, exclude: vec![], @@ -467,17 +467,17 @@ mod tests { Message { kind: CheckKind::UselessObjectInheritance("B".to_string()), location: Location::new(5, 1), - filename: "./resources/test/src/R0205.py".to_string(), + filename: "./resources/test/fixtures/R0205.py".to_string(), }, Message { kind: CheckKind::UselessObjectInheritance("C".to_string()), location: Location::new(9, 1), - filename: "./resources/test/src/R0205.py".to_string(), + filename: "./resources/test/fixtures/R0205.py".to_string(), }, Message { kind: CheckKind::UselessObjectInheritance("D".to_string()), location: Location::new(14, 5), - filename: "./resources/test/src/R0205.py".to_string(), + filename: "./resources/test/fixtures/R0205.py".to_string(), }, ]; assert_eq!(actual.len(), expected.len()); diff --git a/src/pyproject.rs b/src/pyproject.rs index 9aa6f4502e..f34ee5d300 100644 --- a/src/pyproject.rs +++ b/src/pyproject.rs @@ -216,12 +216,12 @@ other-attribute = 1 #[test] fn find_and_parse_pyproject_toml() -> Result<()> { - let project_root = find_project_root([Path::new("resources/test/src/__init__.py")]) + let project_root = find_project_root([Path::new("resources/test/fixtures/__init__.py")]) .expect("Unable to find project root."); - assert_eq!(project_root, Path::new("resources/test/src")); + assert_eq!(project_root, Path::new("resources/test/fixtures")); let path = find_pyproject_toml(&project_root).expect("Unable to find pyproject.toml."); - assert_eq!(path, Path::new("resources/test/src/pyproject.toml")); + assert_eq!(path, Path::new("resources/test/fixtures/pyproject.toml")); let pyproject = parse_pyproject_toml(&path)?; let config = pyproject